{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# US Presidential Debate Sep 26 2016\n", "\n", "This is a Jupyter notebook detailing an analysis of the language used in the first debate.\n", "\n", "Prepared by Doug Blank, Bryn Mawr College \n", "For full discussion, see: http://blankversusblank.blogspot.com/2016/09/post-debate-analysis.html\n", "\n", "Data from http://www.nytimes.com/2016/09/27/us/politics/transcript-debate.html\n", "\n", "There were some errors that I corrected, so you can use the version here [first_debate.txt](first_debate.txt)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we read the text into an array of lines:" ] }, { "cell_type": "code", "execution_count": 165, "metadata": { "collapsed": false }, "outputs": [], "source": [ "text = [line.strip().replace(\"\\n\", \" \").replace(\".\", \" \").replace(\"?\", \" \")\n", " .replace(\"“\", \" \").replace(\"”\", \" \").replace(\":\", \" \")\n", " .replace(\",\", \" \").replace(\"—\", \" \").replace(\"-\", \" \")\n", " for line in open(\"first_debate.txt\").readlines()]\n", "text_all = \" \".join(text)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A sample to see what it looks like:" ] }, { "cell_type": "code", "execution_count": 166, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'HOLT Good evening from Hofstra University in Hempstead New York I’m Lester Holt anchor of NBC Nightly News I want to welcome you to the first presidential debate '" ] }, "execution_count": 166, "metadata": {}, "output_type": "execute_result" } ], "source": [ "text[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, we break it down by speaker:" ] }, { "cell_type": "code", "execution_count": 167, "metadata": { "collapsed": false }, "outputs": [], "source": [ "holt = \"\"\n", "clinton = \"\"\n", "trump = \"\"\n", "\n", "current = None\n", "for line in text:\n", " if not line:\n", " continue\n", " elif line in [\"(APPLAUSE)\", \"(CROSSTALK)\", \"(LAUGHTER)\"]:\n", " continue\n", " elif line.startswith(\"HOLT\"):\n", " current = \"HOLT\"\n", " holt += line[4:] + \" \"\n", " elif line.startswith(\"TRUMP\"):\n", " current = \"TRUMP\"\n", " trump += line[5:] + \" \"\n", " elif line.startswith(\"CLINTON\"):\n", " current = \"CLINTON\"\n", " clinton += line[7:] + \" \"\n", " else:\n", " if current == \"HOLT\":\n", " holt += line + \" \"\n", " elif current == \"TRUMP\":\n", " trump += line + \" \"\n", " elif current == \"CLINTON\":\n", " clinton += line + \" \"\n", " else:\n", " raise Exception(\"No speaker?!\")\n", " \n", "holt = holt.lower()\n", "clinton = clinton.lower()\n", "trump = trump.lower()\n", "\n", "clinton = clinton.strip()\n", "while \" \" in clinton:\n", " clinton = clinton.replace(\" \", \" \")\n", "holt = holt.strip()\n", "while \" \" in holt:\n", " holt = holt.replace(\" \", \" \").strip()\n", "trump = trump.strip()\n", "while \" \" in trump:\n", " trump = trump.replace(\" \", \" \").strip()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Characters:" ] }, { "cell_type": "code", "execution_count": 168, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(10400, 42263, 33173)" ] }, "execution_count": 168, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(holt), len(trump), len(clinton)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And split the text into words:" ] }, { "cell_type": "code", "execution_count": 169, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clinton_words = clinton.split(\" \")\n", "trump_words = trump.split(\" \")\n", "holt_words = holt.split(\" \")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Number of total \"words\" spoken" ] }, { "cell_type": "code", "execution_count": 170, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(6237, 8139, 1878)" ] }, "execution_count": 170, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(clinton_words), len(trump_words), len(holt_words)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Number of unique words spoken" ] }, { "cell_type": "code", "execution_count": 171, "metadata": { "collapsed": true }, "outputs": [], "source": [ "clinton_set = set(clinton_words)\n", "trump_set = set(trump_words)\n", "holt_set = set(holt_words)" ] }, { "cell_type": "code", "execution_count": 172, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(1379, 1269)" ] }, "execution_count": 172, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(clinton_set), len(trump_set)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Number of each word spoken, ranked from highest to lowest" ] }, { "cell_type": "code", "execution_count": 173, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def make_dict(words):\n", " d = {}\n", " for word in words:\n", " count = d.get(word, 0)\n", " d[word] = count + 1\n", " return d" ] }, { "cell_type": "code", "execution_count": 174, "metadata": { "collapsed": false }, "outputs": [], "source": [ "clinton_dict = make_dict(clinton_words)\n", "trump_dict = make_dict(trump_words)" ] }, { "cell_type": "code", "execution_count": 175, "metadata": { "collapsed": true }, "outputs": [], "source": [ "common_words = [\"the\", \"to\", \"and\", \"or\", \"that\", \"of\", \"a\", \"in\", \"have\", \"it\", \"be\",\n", " \"am\", \"are\", \"was\", \"were\", \"been\", \"be\", \"being\", \"is\", \"do\", \"would\",\n", " \"but\", \"what\", \"so\", \"with\", \"about\", \"at\", \"on\", \"has\", \"can\", \"as\",\n", " \"because\", \"when\", \"by\", \"an\", \"for\", \"this\"]" ] }, { "cell_type": "code", "execution_count": 184, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "i: 138\n", "we: 122\n", "you: 76\n", "he: 56\n", "our: 42\n", "not: 40\n", "think: 38\n", "well: 36\n", "people: 32\n", "they: 31\n", "know: 28\n", "going: 27\n", "donald: 26\n", "your: 25\n", "one: 24\n", "need: 23\n", "us: 22\n", "who: 21\n", "more: 21\n", "will: 21\n", "that’s: 21\n", "them: 21\n", "it’s: 21\n", "really: 20\n", "there: 20\n", "their: 19\n", "want: 19\n", "his: 18\n", "from: 18\n", "said: 17\n", "if: 17\n", "we’re: 17\n", "country: 16\n", "just: 16\n", "good: 16\n", "we’ve: 16\n", "jobs: 16\n", "lot: 16\n", "tax: 16\n", "make: 15\n", "get: 15\n", "new: 15\n", "out: 15\n", "up: 15\n", "business: 15\n", "got: 14\n", "how: 14\n", "work: 14\n", "some: 14\n", "should: 14\n", "go: 13\n", "all: 13\n", "economy: 13\n", "very: 13\n", "also: 12\n", "american: 12\n", "had: 12\n", "nuclear: 11\n", "see: 11\n", "he’s: 11\n", "no: 11\n", "down: 10\n", "debt: 10\n", "don’t: 10\n", "look: 10\n", "million: 10\n", "my: 10\n", "too: 10\n", "into: 10\n", "i’ve: 10\n", "actually: 10\n", "many: 10\n", "kind: 10\n", "fact: 10\n", "important: 10\n", "now: 9\n", "put: 9\n", "other: 9\n", "police: 9\n", "deal: 9\n", "did: 9\n", "again: 9\n", "information: 9\n", "middle: 9\n", "say: 9\n", "wealthy: 8\n", "those: 8\n", "first: 8\n", "isis: 8\n", "iran: 8\n", "let’s: 8\n", "plan: 8\n", "president: 8\n", "talk: 8\n", "back: 8\n", "over: 8\n", "then: 8\n", "support: 8\n", "years: 8\n", "much: 7\n", "i’m: 7\n", "lester: 7\n", "ever: 7\n", "things: 7\n", "why: 7\n", "me: 7\n", "class: 7\n", "something: 7\n", "even: 7\n", "paid: 7\n", "state: 7\n", "states: 7\n", "him: 7\n", "working: 7\n", "pay: 7\n", "trade: 7\n", "world: 7\n", "time: 7\n", "proposed: 7\n", "only: 7\n", "communities: 7\n", "home: 7\n", "where: 7\n", "taken: 6\n", "everyone: 6\n", "top: 6\n", "national: 6\n", "young: 6\n", "percent: 6\n", "everything: 6\n", "having: 6\n", "thing: 6\n", "man: 6\n", "money: 6\n", "called: 6\n", "which: 6\n", "they’ve: 6\n", "part: 6\n", "we’ll: 6\n", "made: 6\n", "different: 6\n", "nations: 6\n", "weapons: 6\n", "take: 6\n", "you’re: 6\n", "any: 6\n", "trying: 6\n", "government: 6\n", "after: 6\n", "worked: 6\n", "able: 6\n", "better: 6\n", "against: 6\n", "cyber: 5\n", "returns: 5\n", "obama: 5\n", "two: 5\n", "future: 5\n", "plans: 5\n", "come: 5\n", "iraq: 5\n", "there’s: 5\n", "right: 5\n", "heard: 5\n", "united: 5\n", "kinds: 5\n", "never: 5\n", "these: 5\n", "together: 5\n", "maybe: 5\n", "give: 5\n", "fair: 5\n", "system: 5\n", "believe: 5\n", "number: 5\n", "done: 5\n", "federal: 5\n", "sure: 5\n", "law: 5\n", "long: 5\n", "both: 5\n", "justice: 5\n", "use: 5\n", "incomes: 5\n", "looked: 5\n", "hope: 5\n", "let: 5\n", "doing: 4\n", "like: 4\n", "secretary: 4\n", "saying: 4\n", "benefit: 4\n", "facing: 4\n", "started: 4\n", "facts: 4\n", "troops: 4\n", "york: 4\n", "black: 4\n", "5: 4\n", "does: 4\n", "clean: 4\n", "says: 4\n", "families: 4\n", "hack: 4\n", "clear: 4\n", "provide: 4\n", "went: 4\n", "finally: 4\n", "worst: 4\n", "best: 4\n", "zero: 4\n", "america: 4\n", "determines: 4\n", "debate: 4\n", "deals: 4\n", "means: 4\n", "security: 4\n", "gun: 4\n", "try: 4\n", "understand: 4\n", "they’re: 4\n", "way: 4\n", "real: 4\n", "donald’s: 4\n", "family: 4\n", "taxes: 4\n", "nato: 4\n", "military: 4\n", "help: 4\n", "foreign: 4\n", "attacks: 4\n", "question: 4\n", "trillion: 4\n", "buy: 4\n", "sometimes: 4\n", "making: 4\n", "here: 4\n", "biggest: 4\n", "you’ve: 4\n", "job: 4\n", "reasons: 4\n", "around: 4\n", "russia: 4\n", "hard: 4\n", "year: 4\n", "invest: 4\n", "most: 4\n", "off: 4\n", "same: 4\n", "growth: 4\n", "energy: 4\n", "businesses: 4\n", "small: 4\n", "add: 4\n", "under: 4\n", "away: 4\n", "could: 4\n", "trickle: 4\n", "great: 4\n", "create: 4\n", "still: 4\n", "second: 4\n", "issues: 4\n", "problems: 4\n", "recession: 3\n", "street: 3\n", "father: 3\n", "grow: 3\n", "seen: 3\n", "intelligence: 3\n", "40: 3\n", "another: 3\n", "asked: 3\n", "half: 3\n", "americans: 3\n", "deserve: 3\n", "course: 3\n", "vote: 3\n", "opportunities: 3\n", "building: 3\n", "lose: 3\n", "installers: 3\n", "financial: 3\n", "white: 3\n", "start: 3\n", "private: 3\n", "live: 3\n", "muslim: 3\n", "near: 3\n", "may: 3\n", "she: 3\n", "before: 3\n", "keep: 3\n", "every: 3\n", "race: 3\n", "sailors: 3\n", "stand: 3\n", "life: 3\n", "prepared: 3\n", "responsibilities: 3\n", "college: 3\n", "matter: 3\n", "remember: 3\n", "took: 3\n", "her: 3\n", "release: 3\n", "budget: 3\n", "crime: 3\n", "face: 3\n", "criminal: 3\n", "investments: 3\n", "china: 3\n", "racist: 3\n", "though: 3\n", "war: 3\n", "build: 3\n", "met: 3\n", "policy: 3\n", "voted: 3\n", "tried: 3\n", "health: 3\n", "men: 3\n", "education: 3\n", "efforts: 3\n", "leadership: 3\n", "putin: 3\n", "lie: 3\n", "$5: 3\n", "abroad: 3\n", "absolutely: 3\n", "rising: 3\n", "enough: 3\n", "else: 3\n", "word: 3\n", "problem: 3\n", "barack: 3\n", "can’t: 3\n", "intend: 3\n", "african: 3\n", "happen: 3\n", "share: 3\n", "east: 3\n", "unfortunately: 3\n", "ways: 3\n", "defeat: 3\n" ] } ], "source": [ "for pair in sorted([items for items in clinton_dict.items() if items[0] not in common_words and\n", " items[1] > 2],\n", " key=lambda pair: pair[1], reverse=True):\n", " print(\"%s: %s\" % pair)" ] }, { "cell_type": "code", "execution_count": 177, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(3, 8)" ] }, "execution_count": 177, "metadata": {}, "output_type": "execute_result" } ], "source": [ "clinton_dict[\"china\"], clinton_dict[\"plan\"]" ] }, { "cell_type": "code", "execution_count": 178, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(9, 3)" ] }, "execution_count": 178, "metadata": {}, "output_type": "execute_result" } ], "source": [ "trump_dict[\"china\"], trump_dict[\"plan\"]" ] }, { "cell_type": "code", "execution_count": 185, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "i: 229\n", "you: 189\n", "we: 109\n", "it’s: 72\n", "they: 71\n", "very: 65\n", "our: 55\n", "not: 50\n", "country: 46\n", "going: 43\n", "all: 41\n", "they’re: 40\n", "look: 40\n", "me: 39\n", "said: 37\n", "think: 37\n", "them: 35\n", "just: 35\n", "she: 33\n", "don’t: 32\n", "will: 32\n", "say: 32\n", "i’m: 29\n", "that’s: 29\n", "people: 28\n", "no: 28\n", "doing: 27\n", "out: 27\n", "know: 27\n", "get: 26\n", "secretary: 25\n", "clinton: 25\n", "should: 25\n", "one: 25\n", "we’re: 24\n", "many: 24\n", "want: 23\n", "years: 22\n", "now: 21\n", "thing: 21\n", "things: 21\n", "did: 21\n", "their: 20\n", "like: 20\n", "your: 20\n", "can’t: 20\n", "if: 20\n", "much: 20\n", "other: 20\n", "companies: 20\n", "her: 20\n", "jobs: 19\n", "good: 19\n", "really: 19\n", "well: 19\n", "way: 19\n", "my: 19\n", "some: 19\n", "go: 18\n", "these: 18\n", "from: 17\n", "money: 17\n", "tell: 17\n", "new: 17\n", "over: 16\n", "great: 16\n", "you’re: 16\n", "into: 15\n", "believe: 15\n", "time: 15\n", "lot: 15\n", "tax: 15\n", "us: 15\n", "up: 15\n", "could: 15\n", "leaving: 15\n", "bad: 14\n", "ever: 14\n", "world: 14\n", "deal: 14\n", "isis: 14\n", "he: 14\n", "against: 14\n", "agree: 13\n", "got: 13\n", "more: 13\n", "first: 13\n", "bring: 13\n", "which: 13\n", "back: 13\n", "war: 12\n", "trillion: 12\n", "she’s: 12\n", "i’ll: 12\n", "right: 12\n", "lester: 12\n", "even: 12\n", "than: 12\n", "wrong: 12\n", "countries: 12\n", "where: 12\n", "see: 11\n", "done: 11\n", "had: 11\n", "how: 11\n", "tremendous: 11\n", "take: 11\n", "better: 10\n", "nato: 10\n", "i’ve: 10\n", "also: 10\n", "hillary: 10\n", "politicians: 10\n", "why: 10\n", "there: 10\n", "let: 10\n", "stop: 10\n", "president: 10\n", "doesn’t: 10\n", "taken: 9\n", "there’s: 9\n", "trade: 9\n", "job: 9\n", "didn’t: 9\n", "you’ve: 9\n", "never: 9\n", "him: 9\n", "china: 9\n", "times: 9\n", "maybe: 9\n", "whether: 8\n", "big: 8\n", "trump: 8\n", "come: 8\n", "taking: 8\n", "far: 8\n", "then: 8\n", "almost: 8\n", "campaign: 8\n", "russia: 8\n", "company: 8\n", "community: 8\n", "talking: 8\n", "deals: 8\n", "iran: 8\n", "need: 8\n", "sean: 8\n", "nuclear: 8\n", "happened: 8\n", "regulations: 7\n", "help: 7\n", "obama: 7\n", "greatest: 7\n", "who: 7\n", "saying: 7\n", "nafta: 7\n", "started: 7\n", "down: 7\n", "work: 7\n", "nobody: 7\n", "haven’t: 7\n", "defend: 7\n", "give: 7\n", "experience: 7\n", "nothing: 7\n", "before: 7\n", "30: 7\n", "middle: 7\n", "able: 7\n", "worst: 7\n", "under: 7\n", "paying: 7\n", "make: 7\n", "fact: 7\n", "hannity: 7\n", "day: 7\n", "business: 7\n", "losing: 7\n", "wait: 7\n", "taxes: 7\n", "last: 6\n", "seen: 6\n", "korea: 6\n", "mean: 6\n", "everybody: 6\n", "endorsed: 6\n", "ok: 6\n", "he’s: 6\n", "website: 6\n", "long: 6\n", "another: 6\n", "$20: 6\n", "oil: 6\n", "respond: 6\n", "spent: 6\n", "something: 6\n", "problem: 6\n", "little: 6\n", "debate: 6\n", "political: 6\n", "mess: 6\n", "happen: 6\n", "watch: 6\n", "mexico: 6\n", "release: 6\n", "east: 6\n", "important: 6\n", "laws: 5\n", "cyber: 5\n", "somebody: 5\n", "hundreds: 5\n", "terms: 5\n", "strongly: 5\n", "put: 5\n", "probably: 5\n", "billions: 5\n", "nation: 5\n", "york: 5\n", "million: 5\n", "fed: 5\n", "biggest: 5\n", "north: 5\n", "after: 5\n", "debt: 5\n", "everything: 5\n", "anywhere: 5\n", "used: 5\n", "called: 5\n", "stamina: 5\n", "land: 5\n", "dollars: 5\n", "income: 5\n", "question: 5\n", "major: 5\n", "formed: 5\n", "single: 5\n", "percent: 5\n", "off: 5\n", "true: 5\n", "disaster: 5\n", "only: 5\n", "cannot: 5\n", "fight: 5\n", "i’d: 5\n", "10: 5\n", "old: 5\n", "talks: 5\n", "we’ve: 5\n", "approve: 5\n", "getting: 5\n", "name: 5\n", "made: 5\n", "list: 5\n", "african: 5\n", "murders: 5\n", "totally: 5\n", "four: 5\n", "lots: 5\n", "returns: 5\n", "temperament: 5\n", "care: 5\n", "certainly: 5\n", "states: 4\n", "wealthy: 4\n", "places: 4\n", "certificate: 4\n", "different: 4\n", "interest: 4\n", "supposed: 4\n", "500: 4\n", "number: 4\n", "read: 4\n", "asked: 4\n", "american: 4\n", "thinking: 4\n", "ask: 4\n", "soon: 4\n", "frisk: 4\n", "around: 4\n", "raise: 4\n", "produce: 4\n", "place: 4\n", "sent: 4\n", "advantage: 4\n", "perhaps: 4\n", "year: 4\n", "during: 4\n", "lists: 4\n", "lawsuit: 4\n", "best: 4\n", "any: 4\n", "billion: 4\n", "proud: 4\n", "expand: 4\n", "anybody: 4\n", "gave: 4\n", "actually: 4\n", "iraq: 4\n", "cut: 4\n", "we’ll: 4\n", "find: 4\n", "minute: 4\n", "airports: 4\n", "relationships: 4\n", "does: 4\n", "once: 4\n", "two: 4\n", "audited: 4\n", "brought: 4\n", "japan: 4\n", "kind: 4\n", "real: 4\n", "budget: 4\n", "birth: 4\n", "excuse: 4\n", "what’s: 4\n", "week: 4\n", "talk: 4\n", "they’ve: 4\n", "needs: 4\n", "inner: 4\n", "cities: 4\n", "left: 4\n", "learn: 4\n", "tough: 4\n", "too: 4\n", "build: 3\n", "beautiful: 3\n", "night: 3\n", "myself: 3\n", "his: 3\n", "article: 3\n", "audit: 3\n", "feel: 3\n", "15: 3\n", "coming: 3\n", "concerned: 3\n", "reason: 3\n", "energy: 3\n", "yes: 3\n", "wonder: 3\n", "avenue: 3\n", "met: 3\n", "releases: 3\n", "trying: 3\n", "created: 3\n", "unbelievable: 3\n", "happy: 3\n", "strong: 3\n", "defective: 3\n", "quickly: 3\n", "5: 3\n", "fine: 3\n", "banks: 3\n", "800: 3\n", "course: 3\n", "shows: 3\n", "small: 3\n", "call: 3\n", "interview: 3\n", "200: 3\n", "$650: 3\n", "badly: 3\n", "michael: 3\n", "control: 3\n", "blumenthal: 3\n", "mine: 3\n", "life: 3\n", "roads: 3\n", "terror: 3\n", "000: 3\n", "looks: 3\n", "e: 3\n", "bit: 3\n", "start: 3\n", "thousands: 3\n", "dnc: 3\n", "hard: 3\n", "telling: 3\n", "arabia: 3\n", "communities: 3\n", "schedule: 3\n", "pennsylvania: 3\n", "history: 3\n", "opening: 3\n", "united: 3\n", "plants: 3\n", "isn’t: 3\n", "economy: 3\n", "cost: 3\n", "millions: 3\n", "told: 3\n", "numbers: 3\n", "own: 3\n", "assets: 3\n", "thinks: 3\n", "same: 3\n", "impact: 3\n", "reporter: 3\n", "estate: 3\n", "every: 3\n", "credit: 3\n", "went: 3\n", "anything: 3\n", "saudi: 3\n", "within: 3\n", "approved: 3\n", "person: 3\n", "d: 3\n", "keeping: 3\n", "election: 3\n", "end: 3\n", "admirals: 3\n", "fifth: 3\n", "manager: 3\n", "donald: 3\n", "yeah: 3\n", "mails: 3\n", "since: 3\n", "internet: 3\n", "certain: 3\n", "mainstream: 3\n", "fault: 3\n", "plan: 3\n", "order: 3\n", "ohio: 3\n", "shear: 3\n", "ahead: 3\n", "ago: 3\n", "winning: 3\n", "win: 3\n", "signed: 3\n", "love: 3\n", "nice: 3\n", "report: 3\n", "truth: 3\n", "defending: 3\n", "terrible: 3\n", "fly: 3\n", "obama’s: 3\n", "family: 3\n", "sell: 3\n", "rates: 3\n", "pay: 3\n", "frankly: 3\n", "oh: 3\n", "most: 3\n", "story: 3\n", "power: 3\n", "audit’s: 3\n", "worth: 3\n" ] } ], "source": [ "for pair in sorted([items for items in trump_dict.items() if items[0] not in common_words and\n", " items[1] > 2],\n", " key=lambda pair: pair[1], reverse=True):\n", " print(\"%s: %s\" % pair)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How often did they speak" ] }, { "cell_type": "code", "execution_count": 180, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "126" ] }, "execution_count": 180, "metadata": {}, "output_type": "execute_result" } ], "source": [ "text_all.count(\"TRUMP\")" ] }, { "cell_type": "code", "execution_count": 181, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "93" ] }, "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ "text_all.count(\"CLINTON\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 1 }