On this page
Topic models find groups of words that tend to occur together across a corpus. That makes them a way to read hundreds of novels at once, and to find the smaller sets of books and chapters worth reading closely. We applied three approaches to the corpus. The first two, LDA and BERTopic, focus on the subset of Temple’s collection identified as climate fiction. The third maps that subset alongside other genres.
LDA topic modeling#
By Megan Kane
LDA (Latent Dirichlet Allocation) topic modeling assumes that documents are mixtures of topics, with the number of topics set by the researcher, and that topics are mixtures of words. To decide which words belong to which topic, LDA starts by assigning each word in the corpus to a topic at random. It then iterates over those assignments, adjusting them until each word sits in the topic where it most probably belongs. Because LDA depends on word frequencies rather than word order, it works well on disaggregated texts like our extracted-features datasets.
We ran LDA with Gensim on the climate-fiction subset of Temple’s science fiction corpus, after removing stopwords and non-English words. We compared C_V and U_Mass coherence scores across models and found that 200 topics gave the most coherent co-occurrences of words and documents.

Explore the interactive LDAvis model → Select any of the 200 topics, and adjust the relevance slider to move between a topic’s most frequent terms and its most distinctive ones.
BERTopic topic modeling#
BERTopic builds topic clusters from word embeddings and a class-based TF-IDF. It produces a set of topics, the top words in each, and the likelihood that each text belongs to each topic. Because it relies on embeddings of words in context, it does not work well with disaggregated texts.
Unlike LDA, BERTopic chooses the number of topics itself, though you can set parameters to merge topics that are very similar. On our corpus it produced 91 topics, not counting outliers.

To look more closely, we can extract and visualize the top words per topic:

Topics of interest#
The most frequent words in a few topics that speak to the climate-fiction focus of the corpus:




Topic usage by author#
We can also compare how different authors use topics. Here, for example, is the distribution of topics in the work of Brian Aldiss and Ursula K. Le Guin:

Topic usage over time#
This graph shows how often authors used topics of interest across the twentieth century.

Mapping semantic similarity with Atlas#
Atlas, from Nomic, is a web platform for exploring large datasets. Researchers can use it to cluster texts by semantic similarity and project them onto a map, as shown below. You can then investigate similarities between data points, refine the dataset, and build new maps from relevant subsets. Maps can be shared publicly for others to explore.
We used Python to map embeddings of 142 texts from our corpus identified as climate fiction. Alongside them we mapped embeddings of science fiction, detective fiction, and fantasy texts from Project Gutenberg. This let us compare the semantic similarities among the three genres, and look for anything that sets climate fiction apart from science fiction more broadly.

Explore the interactive version of this map on Nomic Atlas (opens in a new tab).