What I did

For my final project, I returned to Project Gutenberg and the question of banned books. Throughout the semester, I’ve been working with a corpus consisting of the top 20 most popular books on Project Gutenberg from Anne Haight’s 1978 publication: ‘Banned books: informal notes on some books banned for various reasons at various times and in various places’

https://catalog.lib.ncsu.edu/catalog/NCSU233622

Case Study: Leaves of Grass, by Walt Whitman

My original goal with my first independent analysis was to determine if there is indeed anything particularly risqué that shows up at the level of individual words in some commonly banned/challenged books. The results were intriguing, if pretty limited. I then applied topic modeling methods in a subsequent analysis to see if a more nuanced analysis emerged, and wasn’t really impressed with the results there either. In both cases, I determined that looking at so many disparate books at once was really muddying my results.

This time, then, I decided to focus on a single banned book as a case study: Leaves of Grass by Walt Whitman.

What’s so bad about some leaves and grass anyway?

Whitman’s contemporaries definitely didn’t see this book as mere detritus. I was able to get a hold of the full text of Banned Books via HathiTrust, and here are Anne Haight’s notes on Leaves:

An online exhibition from UVA: “Censored: Wielding the Red Pen”, provides further context:

Walt Whitman’s Leaves of Grass created an uproar from the moment it was first published in 1855 and all through its subsequent nine editions. This classic work of poetry was deemed “obscene,” “too sensual,” and “shocking” because of its frank portrayal of sexuality and its obvious homoerotic overtones. In 1865, Whitman lost his job as a clerk with the Department of the Interior, when his supervisor found the annotated copy, on display, among Whitman’s possessions at work. In 1870, Yale University President Noah Porter compared Whitman’s offense in writing Leaves of Grass to that of “walking naked through the streets.” With the single known exception of the Library Company of Philadelphia, libraries refused to buy the book, and the poem was legally banned in Boston in the 1880s and informally banned elsewhere. Most booksellers agreed to neither publicize nor recommend Leaves of Grass to customers, and in 1881, the Boston District Attorney threatened Whitman’s publisher with criminal prosecution, at the urging of the Society for the Suppression of Vice, causing a proposed new edition to be withdrawn from publication.

In this whirlwind of condemnation, a few voices spoke up in favor of the poem. From the very outset, Ralph Waldo Emerson recognized the work’s genius, calling Leaves “the most extraordinary piece of wit and wisdom that America has yet contributed.”

Purpose/Research Questions

With these things in mind…

Purpose:
To experiment with text mining methods to see if they can surface any of the notions for which Whitman was apparently shunned for in his works.

Target Audience: Digital humanities scholars + librarians who may be interested in seeing how text mining methods might be leveraged for gleaning the themes of texts and what questions they might be able to help answer related to censorship.

Research Questions:
- Does anything saucy emerge at the word count/frequency level?
- What about at the topic level using LDA?
- Might we see some naughty bi-grams or tri-grams?

Methods

Pre-processing steps

  1. I downloaded ‘Leaves of Grass’ using the gutenbergr package, which is helpful in that it automatically removes some of the front matter and custom stop words related to Project Gutenberg.

  2. I tokenized and tidied the text, filtering out some custom stop words that show up a lot on Whitman’s poetry, such as “thy”, “thou” and “thee”.

  3. I initially tried stemming the text but found the topic models difficult to interpret once I had, so I ultimately elected to leave stemming out of the picture.

  4. I ‘chunked’ the text into discrete chapters for easier topic modeling. See that section for more information.

Basic word counts

A look at the basic word counts produces about what one would expect:

Topic modeling using LDA

Things start to get a bit more interesting with topic modeling. I specifically used LDA, or Latent Dirichlet Allocation

As described in Text Mining with R:

"Topic modeling is a method for unsupervised classification of such documents, similar to clustering on numeric data, which finds natural groups of items even when we’re not sure what we’re looking for.

Latent Dirichlet allocation (LDA) is a particularly popular method for fitting a topic model. It treats each document as a mixture of topics, and each topic as a mixture of words. This allows documents to “overlap” each other in terms of content, rather than being separated into discrete groups, in a way that mirrors typical use of natural language."

In Matthew L. Jockers’ blog post ‘“Secret” Recipe for Topic Modeling Themes’, it is suggested to use a ‘chunking’ method to break down large texts into bite-sized pieces (i.e., documents) for modeling.

I was able to accomplish something similar following the example provded in ‘Text Mining with R’ in which a book is broken down into its chapters (or in the case of Leaves of Grass, “books”).

by_chapter <- leaves_of_grass %>%
  mutate(chapter = cumsum(str_detect(
    text, regex("^BOOK ", ignore_case = FALSE)
  ))) %>%
  ungroup() %>%
  filter(chapter > 0) %>%
  unite(document, chapter)

There are are 34 chapters (“books”) in Leaves, so I originally set my number of topics at 34. This produced some interesting results:

But running “Finding K” revealed that the ideal number of topics might actually be 10.

Here’s what that looked like:

Looking at the results of these models drove home one point we’ve discussed many times this semester: it’s important to have some familiarity with your subject matter! Text mining methods can’t be a stand in for other kinds of scholarship, they can only add to the knowledge you may already have. And a Whitman scholar I am not, meaning I’m not able to make much sense out of these models. If I were a Whitman scholar, I’m sure I’d be able to pick up on whether or not any of these topics are representative of commonly accepted themes in his poetry.

I know that Whitman was well known for writing about place, and topics 1, 7, and 30 when k = 34 look like they might be in that vein. His poetry has also been analyzed by many queer theorists, but it’s much harder to tell at the topic level with either value of k if any themes of homoeroticism are present.

What may be more helpful for a lay-person like me, then, is a look at some other kinds of metrics, such as bi-grams and tri-grams.

Sentiment analysis using NRC

But first, just for kicks, I decided to use the NRC lexicon to do some sentiment analysis.

“The NRC Emotion Lexicon is a list of English words and their associations with eight basic emotions (anger, fear, anticipation, trust, surprise, sadness, joy, and disgust) and two sentiments (negative and positive). The annotations were manually done by crowdsourcing.”

Based on the results, I think it’s safe to say that overall Whitman’s poetry conveys more positive than negative emotions:

Bi-grams + tri-grams

Ok, bi-grams (or pairs of words that appear together)…

## # A tibble: 15,661 x 3
##    word1   word2      n
##    <chr>   <chr>  <int>
##  1 en      masse      9
##  2 live    oak        9
##  3 western sea        9
##  4 death   death      7
##  5 white   hair       7
##  6 dear    friend     6
##  7 dear    son        6
##  8 due     time       6
##  9 flood   tide       6
## 10 north   south      6
## # … with 15,651 more rows

…and tri-grams (three words that appear together in a row):

## # A tibble: 5,421 x 4
##    word1     word2     word3      n
##    <chr>     <chr>     <chr>  <int>
##  1 beat      beat      drums      5
##  2 death     death     death      5
##  3 gray      brown     bird       4
##  4 heart     shaped    leaves     4
##  5 beat      drums     blow       3
##  6 bivouac’s fitful    flame      3
##  7 blow      bugles    blow       3
##  8 blue      ontario’s shore      3
##  9 drums     blow      bugles     3
## 10 fish      shaped    island     3
## # … with 5,411 more rows

While not particularly saucy or naughty, I do think these are – dare I say it – downright poetic?

Selected quotes using filter() + grepl()

Alright, so what about some specific quotes for additional context?

Let’s see, for example, where his most used word, ‘love’, shows up:

## # A tibble: 10 x 1
##    text                                                                         
##    <chr>                                                                        
##  1 "  Smile, for your lover comes."                                             
##  2 "  No danger shall balk Columbia’s lovers,"                                  
##  3 "  Embalm’d with love in this twilight song."                                
##  4 "  Nothing was greater there than the quality of robust love, it led the res…
##  5 "  It may be if I had known them I would have loved them,"                   
##  6 "  I bequeath myself to the dirt to grow from the grass I love,"             
##  7 "      what he or she did, felt, became, loved, sinn’d, in life."            
##  8 "  The heart of man and woman all for love,"                                 
##  9 "  What curious questioning glances--glints of love!"                        
## 10 "  Come tell us old man, as from young men and maidens that love me,"

What about ‘death’?:

## # A tibble: 10 x 1
##    text                                                                        
##    <chr>                                                                       
##  1 "  The houses full of life were equally full of death, (this house is now,)"
##  2 "      about death.)"                                                       
##  3 "      early death;"                                                        
##  4 "  O death, I cover you over with roses and early lilies,"                  
##  5 "  Of life or death, or soldier’s wound, of country’s loss or safety,"      
##  6 "  With the old streams of death.)"                                         
##  7 "  Old age, flowing free with the delicious near-by freedom of death."      
##  8 "  Not the perfumes of flowers, but sweeter, and wafted beyond death."      
##  9 "  Found you in death so cold dear comrade, found your body son of"         
## 10 "      provided for, and that the deaths of young women and the"

Maybe the word ‘man’, that shows up in the top topic when k=34?:

## # A tibble: 10 x 1
##    text                                                                   
##    <chr>                                                                  
##  1 "  Haply the brutish measureless human undergrowth I know,"            
##  2 "  Nor helm nor helmsman."                                             
##  3 "  I am with you, you men and women of a generation, or ever so many"  
##  4 "      and well-grain’d manhood,"                                      
##  5 "  (Only what proves itself to every man and woman is so,"             
##  6 "  How dare you place any thing before a man?"                         
##  7 "  The human-divine inventions, the labor-saving implements;"          
##  8 "  Human bodies are words, myriads of words,"                          
##  9 "  Does it answer universal needs? will it improve manners?"           
## 10 "  But out spake too the Soul of man, proud, jealous and unreconciled,"

And ‘woman’?:

## # A tibble: 10 x 1
##    text                                                                         
##    <chr>                                                                        
##  1 "  You Japanese man or woman! you liver in Madagascar, Ceylon, Sumatra, Born…
##  2 "  You womanhood divine, mistress and source of all, whence life and"        
##  3 "  Then toward that man or that woman swiftly hasten all--none"              
##  4 "      father’s, young man’s, young woman’s poems,"                          
##  5 "  Unfolded only out of the inimitable poems of woman can come the"          
##  6 "  Unfolded out of the folds of the woman man comes unfolded, and is"        
##  7 "  Without shame the woman I like knows and avows hers."                     
##  8 "  There is no virtue, no beauty in man or woman, but as good is in you,"    
##  9 "  The oath of the inseparableness of two together, of the woman that"       
## 10 "  But each man and each woman of you I lead upon a knoll,"

‘body’?:

## # A tibble: 10 x 1
##    text                                                                         
##    <chr>                                                                        
##  1 "      body, if not more."                                                   
##  2 "  Whoever you are, how superb and how divine is your body, or any part"     
##  3 "  You are the gates of the body, and you are the gates of the soul."        
##  4 "  Wrench’d and sweaty--calm and cool then my body becomes,"                 
##  5 "  Askers embody themselves in me and I am embodied in them,"                
##  6 "      themselves, the body of the flock feed, the sentinels outside"        
##  7 "  Of your real body and any man’s or woman’s real body,"                    
##  8 "      that corrupted her own live body?"                                    
##  9 "  I have said that the soul is not more than the body,"                     
## 10 "  Another time trailing for blue-fish off Paumanok, I stand with braced bod…

While poetry is a bit more abstract than prose or non-fiction and maybe therefore even more impervious to any obvious meaning to be gleaned from text mining methods like this…the context provided by the filter() and grepl() functions does give you some sense of the sensuality that obviously upset some Victorian sensibilities. I would venture that there is indeed some saucy and naughty material in there. But material worthy of censorship? This librarian says ‘nah’.

Conclusion, Limitations, implications

Conclusions:
- Automated text analysis like this is never going to be a stand in for a human read through in determining the themes of a text and or whether a text should be regulated in any way. It can, however, be a good way to augment or add to your understanding of a text.

Limitations:
- Know thy subject matter! Again, I am not a Whitman scholar and so not as capable of interpreting my outputs as someone who is a Whitman scholar might be.

Implications:
- While we are on the subject of censorship, I’ve been hearing/reading a lot of news stories recently about Facebook’s oversight board + general content moderation methods. I was honestly surprised to learn that they have never really relied on automation for their content moderation, and instead have teams of real people who are responsible for reviewing things and making decisions. But given what we’ve seen this semester with our forays into text mining, I can see why this is the case and honestly can’t envision a world in which we are able to trust the tech entirely to handle something as delicate and controversial as censorship.