Every line in
‘The Office’

A text analysis of each character's role in the show

BY Júlia Ledur

Published August 15, 2018

Number of lines spoken by character


image description

Looking at the number of lines each character said in the entire show, it’s not surprising to see Michael Scott on the top of the list, followed by Dwight, Jim and Pam, the three other main characters of the NBC show. After them, Angela, Andy, Oscar, Kevin and other primary characters rank on the top 13. Curiously, even though Michael leaves the show in the last two seasons, he says almost twice as much as Dwight, the second most talkative character.

On the 14th position, however, is Jan, a secondary character who plays Michael’s boss and girlfriend. She is ranked before Toby, Stanley and Meredith, who appear in every season of the show. Other secondary character who also rank in the top 20 are Nellie, who plays manager for some episodes in the seventh season, Holly, Dunder Mifflin’s employer and Michael’s girlfriend, and Gabe, Sabre’s employer who is introduced in the show towards the end of the sixth season.

A sentiment analysis
of the main characters


image description

In terms of the characters’ positivity, Michael ranks in first place once again. A sentiment analysis* of the show’s lines shows that, in a scale from 0 to 1, he has a positivity of 1. The second position is occupied by Jim (0.9), followed by Ryan (also 0.9) and Pam (0.8). The most negative characters are Stanley, Meredith and Angela (0.3), followed by Kelly (0.4).

A text analysis filtering laughs and crying reveals that, as expected, Michael is the character who laughs (and cries) the most. In both ranks, he is followed by Dwight, Jim, Pam and Andy. The 6th position in the cheerful list is occupied by Erin, while Angela sits in the 6th place in the sad rank.

Every ‘That’s what she said’
in the entire show

image description

The “that’s what she said” joke is inseparably associated with Michael, which makes a lot of sense, since he’s by far the character who says it the most. From the total of 40 jokes, there are only a few in the absence of Steve Carell’s character, pulled off by Holly, Pam, Jan and Creed. The last and more legendary one is made at Dwight’s wedding by Michael, in his unforgettable return to the show in the last episode.

* The sentiment analysis was done using TextBlob, a Python library for processing textual data that performs tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation. The library breaks the text into phrases and analyzes the sentiment of each phrase, using the PatternAnalyzer (based on the pattern library).