What time is it? Temporal Analysis of Novels (2020)

Abstract: Recognizing the flow of time in a story is a crucial aspect of understanding it. Prior work related to time has primarily focused on identifying temporal expressions or relative sequencing of events, but here we propose computationally annotating each line of a book with wall clock times, even in the absence of explicit time-descriptive phrases. To do so, we construct a data set of hourly time phrases from 52,183 fictional books. We then construct a time-of-day classification model that achieves an average error of 2.27 hours. Furthermore, we show that by analyzing a book in whole using dynamic programming of breakpoints, we can roughly partition a book into segments that each correspond to a particular time-of-day. This approach improves upon baselines by over two hour. Finally, we apply our model to a corpus of literature categorized by different periods in history, to show interesting trends of hourly activity throughout the past. Among several observations we find that the fraction of events taking place past 10 P.M jumps past 1880 - coincident with the advent of the electric light bulb and city lights.

## introduction the flow of time is an indispensable guide for our actions, and provides a framework in which to see a logical progression of events. just as in real life, the clock provides the background against which literary works play out: when characters wake, eat, and act. in most works of fiction, the events of the story take place during recognizable time periods over the course of the day. recognizing a story's flow through time is essential to understanding the text. in this paper, we try to capture the flow of time through novels by attempting to recognize what time of day each event in the story takes place at. as our motivating example, we use "the great gatsby" @xcite , a short novel with a familiar plot that can be analyzed with our techniques. figure 1 presents the work of two human annotators, independently making their best guesses of the clock time at every paragraph of the book. the x-axis of figure 1 represents the full text of the book as enumerated by paragraph numbers, while the y-axis represents the 24 hours of the day. the times identified by the annotators are shown in blue, while our model's time predictions are shown in red. we first note that there is general but not perfect agreement between the annotators, with an average disagreement of 1.85 hours. there is also a strong general agreement between the model and the annotators, with an average absolute error of 2.62 hours, computed by taking the minimum time difference from either of the annotators. although human readers are generally able to track the flow of texts, this task is more difficult than may initially be supposed -because there are surprisingly few actual times reported in most books. figure 2 shows how many explicit hourly time phrases appear in our dataset of 52,183 novels. about 6,000 of these books contain zero time references to any hour. among the books that do contain clock times, most of them contain fewer than twenty references. events are often described in a neutral manner that does not signal much about exactly when it is taking place. this scarcity of time references presents a big challenge in developing good models and in interpreting the evidence associated with a particular text. because of the lack of explicit references, some notion of likelihood must be part of the model. for this reason, we model time as a probability distribution of what hour it likely is at this juncture. our contributions 1 in this paper include: ## dataset preparation we initially started with a dataset of 10,489 gutenberg books as well as 97,772 hathitrust books, which were filtered to be english fiction (underwood), but these contained numerous duplicates of the same book as well as duplicates between the gutenberg dataset. these were deduplicated based on title and author similarity for a resulting count of 52,183 unique books over both sets. for the sake of completeness, we present results in this paper that use gutenberg and hathitrust books independently. regarding the format of the data, the gutenberg books are provided as a raw text files and were cleaned to strip headers and front matter. the hathitrust books were provided as a folder of text files representing pages. these were preprocessed to strip headers using the hathitrust research center runningheaders tool foot_0 as well as to separate out the body of the book from its front and back matter @xcite . we also performed further preprocessing to split them into paragraphs, sentences, and tokens. among the preprocessing tasks, the most important task was to annotate which tokens belong to time phrases. this was done using sutime library (chang and manning, 2012) to tag time terms, which uses a regular expression based approach. in particular, we focused on times that pinpointed hours within a day such as "two o'clock" or "noon". the library provides the terms as well as the time it can be translated to. an hour out of the 24 hour clock while the third column shows the number of time references that can only be determined down to the 12 hour clock. time phrases can be disambiguated with words such as "am" or "pm", or if the time is connected to a prepositional phrase such as "three in the afternoon". however, it is more often the case that time phrases are used without explicit labels. references to a certain time like "eight o'clock" usually do not come with an "am" or "pm" tag as it is often inferred from context. note that we especially have many samples for hour 0 -midnight and noon -simply because those are more commonly used phrases as opposed to prepositional phrases such as "five o'clock at night". we also note that there are abnormally large amounts of examples for 1 a.m. in the hathi dataset. we found that this was largely due to ocr errors that transcribed "i am" to "1 am". ## time prediction from text for a given window of sentences, we seek to predict the hour it is most likely taking place in. to construct models for this task, we use the time phrases from section 3, but recall much of the time phrases were unlabeled. given the limited amount of labeled data, we first want to augment our dataset by labeling the unlabeled data as well. thus, we have a two step approach: ## book-length time prediction given a model that can predict the time of day for a single window of sentences, we now consider predicting the time of day over an entire bookconstructing a time flow through the book. the simplest idea is to partition the book into windows that fit into the model and independently predict an hour for each window using the model. however, this will have very poor performance since many windows will consist of sentences that have no bearing to time and in these cases, the model will output an arbitrary time that will not fit with its surroundings. to resolve this, we consider the problem of optimally partitioning the windows into larger segments corresponding to particular hours. more formally, given a sequence of sentence windows s 1 , s 2 , . . . , s n and the number of segments, parameterized as k, our goal is to generate the most likely list of indices i 1 , i 2 , . . . , i k that represent the start of each segment, and a list of hours h 1 , h 2 , . . . , h k that represents the corresponding hour assigned to each segment. ## historical trends in the end, we use our book-length time prediction through all the gutenberg books in our dataset and found the distribution of times throughout each book. while the dataset does not have the publication date of the book in the metadata, we were able to access the authors and the years the author was alive. thus, we created groupings of our data by time period based on the year of the author's birth. we group the authors by year of birth, separated every 20 years. figure 3 shows the results for six groupings of years. we consider all books up to 1800 to be one group, then every 20 years afterwards up to 1900, and all books from 1900 and beyond to be the final group. we first note the number of books in each grouping. given copyright laws, most of the books we have access to are in the late 1800s as shown by the number column. we see some interesting trends. for example, noon and afternoons (12 to 5 p.m) are referenced more as the periods pass. additionally, the times around dinner (6 to 9 p.m.) are referenced much more in earlier books, but become less relevant in later periods. the emphasis tends to shift towards later at night (11 p.m to 1 a.m). we also see a decrease in emphasis in the morning from 8 to 9 a.m. overall, the emphasis seems to shift towards the afternoon and late nights and away from mornings and evenings as we progress through the books historically, which can potentially be attributed to the rise in the emphasis on lunch times as well as the advent of electric lighting, along with a decreased emphasis on family dinners. ## conclusions and future work we have constructed a dataset of time phrases to build models that can predict the most relevant hour of the day for a given text window. our models are a good start, but we release the dataset to encourage others to improve on this task. we note that this dataset can be further cleaned by resolving ocr errors in the source text as well as improving upon the time extraction algorithm. more annotations of complete novels would permit better models and evaluation. full time annotations of novels additionally include the challenging task of distinguishing between narrator and recall time in discussing past events. we also seek to annotate information about dates and seasons. future work includes applying time inference models to question answering and other nlp systems.