Journey to Middle Earth - Webscraping the Lord of the Rings

Avatar
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

Avatar

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

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp