Word clouds do not have sentiment analysis included by default. If you generate a word cloud for the first paragraphs of East of Eden by John Steinbeck, some words that seem important appear bigger.
This is because the word cloud includes the NLTK library to remove stopwords. Stopwords are words like “and” and “the,” which don’t have much meaning but occur frequently.
If you generate the same word cloud, but do not remove stopwords, here is what the text looks like when analyzed as a word cloud.
The following word cloud includes all words in the text, including stopwords. Notice how words like "the" appear prominently because they occur frequently.
Learn more about stopwords here
The word frequencies from the text (including stopwords) are displayed in this table, showing which words appear most often. For example, the word "the" appears 8 times. Below is a chart illustrating the top word frequencies:
If you want to include stopwords in your word cloud, you can. Here is the code to do that:
python
from wordcloud import WordCloud
import matplotlib.pyplot as plt
text = "Your sample text here"
cloud = WordCloud(background_color="white").generate(text)
plt.figure(figsize=(10, 6))
plt.imshow(cloud, interpolation="bilinear")
plt.axis("off")
plt.title("Word Cloud With Stopwords")
plt.show()
This refined word cloud excludes stopwords, focusing on thematically meaningful words like "remember," "smell," and "earth."
Frequency of Occurrence:
-
Even without sentiment analysis, some words may seem to stand out. Words like "remember" and "smell" may occur more often in the text of East of Eden.
-
Relevance to Themes: If the words "remember" and "smell" are central to the book’s themes or repeated in key passages, their size will reflect that.
-
Use of stopword Filtering: Common stopwords (e.g., "the," "and," "is") are usually filtered out by default in libraries like WordCloud. This ensures the focus is on more meaningful words, such as those central to the narrative.
To recreate these figures, run the app.py script in this repository. Ensure you have the following libraries installed:
bash
pip install wordcloud matplotlib pandas nltk
This project is licensed under the Creative Commons Attribution 4.0 International License.
See the full license text in the LICENSE file.


