As Kurt Vonnegut argued in a now-famous lecture, . As you read a novel, you feel the emotions of the protagonists, sharing their fears, their anger at injustices, surprise when their assumptions turn out to be wrong, and joy when they finally solve their problems. Vonnegut was speaking theoretically from his experience as an author, but what if we could train computers to tap into that emotion and—in the process—produce real data? A new analysis of 3377 works of fiction has done just that. The stories, from an online repository of books in the public domain called , fell into one of six genres: mystery, humor, fantasy, horror, western, and science fiction. To track the works’ “emotional shape,” scientists used a massive online dictionary that categorizes words by the emotions they tend to be associated with: anger, disgust, fear, joy, sadness, or surprise. Armed with this information, the researchers programmed computers to come up with a six-dimensional score for every single sentence in each novel, which they then used to trace the order and intensity of emotions in each work. For example, , by Mary Shelley, grows steadily in anger and fear over the course of the novel, with little change in other emotions save a big spike in sadness in the middle. But the picture looks completely different for , by Anne Austin, a classic mystery novel that slowly drains of joy until it suddenly spikes at the end, along with a burst of surprise. The surprise for the researchers was that this emotional shape could help a computer predict its genre. In the current study, published this week in PLOS ONE, of the time, much higher than the 17% expected from random guessing. The most common mistake the computer made was misclassifying horror novels as either science fiction or fantasy—perhaps not so surprising given the ambiguity between those genres. The one emotion that stood out as the strongest emotional discriminator between genres was fear. Could that be fiction's secret sauce?