Journey to Middle Earth - Webscraping the Lord of the Rings

Posted on Jan 9, 2018

The Lord of the Rings is an epic high fantasy novel written by English author and scholar J. R. R. Tolkien. It built Middle Earth, a multi-race inhabited world as setting of whole story. In this project, I will mainly focus on finding funny facts of middle earth and analyzing movie script of Lord of the Rings trilogy.

 

Webscraping


Since there was no related dataset, I should start from scraping data online. I found two website:

lotr.wikia - which included demography information for Middle Earth

ageofthering.com - which included movie script of  the Lord of the Rings

For the demography website, I scraped name, birth and death year, gender, race, spouse, hair, height, realm, etc. of a thousand characters in Middle Earth. For the movie script website, I scraped all the lines of three Lord of the Rings movies along with name of movies and name of characters that line belongs to, which gave me another 2400 rows dataset.

 

Demography in Middle Earth


The first plot shows the race and gender distribution among those 1000 characters. Obviously that men are the majority race in the whole story and most of the characters described in the book is male. To be noticed that there is only one female dwarf in whole story and no female orc at all.

The second plot shows the average life span for different race. As shown, Maiar has extremely long lifespan (seems won’t die unless unnatural causes). After did more research on that race, I found that many important characters such as Gandalf, Saruman and Sauron were all belong to that race and lived for more than 7000 years already.

The third plot shows the count of inhabitants of different race by year in Middle Earth. Population of elves seems pretty stable before fourth age because its long lifespan. As Lord of the Rings trilogy happened, the population structure dramatically changed.

Notice that the data only includes characters have been written in the book, the result above does not represent whole population of Middle Earth.

 

The plots above show the marital status in Middle Earth. Reasonably, Hobbits have the highest marriage rate among all races. Although only one female dwarf mentioned in the book, there are still 36% dwarves married, most of them are supposed to marry unmentioned female dwarves. Orcs never married. Additionally, there are no homosexual marriage in the whole story and only one character has remarriage.

 

Movie Script


The chart above shows number of sentences spoken by different characters in different movies.

The word cloud shows frequency of words spoken by different characters. The most frequent word spoken by Frodo and Sam is each other’s name. Comparing Gandalf and Aragorn, it’s easy to find that the most frequent words spoken by such heroic character is “Will”. Although sharing same body, Gollum and Sméagol have totally different personalities, and the words cloud well represent the difference.

 

Sentimental Analysis 


The bubble chart above shows the result of sentimental analysis on sentences spoken by different characters. Not surprisingly, Merry and Pippin, those two happy hobbits get the highest positive score. But unexpectedly, Sam has the highest negative score. It might because he is the person who gives Frodo exhortation, tells him what shouldn’t do, who shouldn’t trust and always considers danger, which makes his words sounds more negative.


Thanks for browsing my work! If you have any question or suggestion, please feel free to contact me via my email : [email protected]

About Author

Tianyi Gu

Tianyi Gu is a creative thinker with strong quantitative and analytical skills. Tianyi received his MS in Urban Informatics from New York University and BS in Actuarial Science from SUNY Buffalo. With great passion in infinite possibilities in...
View all posts by Tianyi Gu >

Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags