BERT-based Sentiment Analysis and Visualization of Plato’s Republic I~II

towards-data-science

This post was originally published by Mr. Nemo & Data at Towards Data Science

Plato’s Republic, which introduces questions that dominate western political philosophy even nowadays, is fundamentally a dialogue. Plato endeavours to conceptualize the ideal society through philosophical discussions and these tendencies for spirited debates are quite explicit in books I~II. Early in The Republic, Socrates refutes the potential definitions of justice suggested by various figures such as Cephalus, Polemarchus, and Thrasymachus. Since negative emotions often accompanied these arguments, I thought conducting sentiment analysis could help contextualize the main ideas covered in The Republic. Using the BERT-based sentiment classification model provided by Huggingface’s Transformers package, I attempted to extract the sentence tokens of negative sentiment and visualize their word frequencies with the Scattertext package.

Data Preprocessing Code

Sentiment Analysis Visualization Code

ScatterText Visualization of Sentiment Analysis Results

Plato’s Republic Book I~II Dataset

Speaker Visualization Code

ScatterText Visualization of Cephalus’ Dialogues

ScatterText Visualization of Polemarchus’ Dialogues

ScatterText Visualization of Thrasymachus’ Dialogues

ScatterText Visualization of Glaucon’s Dialogues

ScatterText Visualization of Adeimantus’ Dialogues

Spread the word

This post was originally published by Mr. Nemo & Data at Towards Data Science

Related posts