{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ " text = \"HOLT: Good luck to you. [applause] \\\n", " Well, I don’t expect us to cover all the issues of this campaign tonight, but I remind everyone, there are two more presidential debates scheduled. We are going to focus on many of the issues that voters tell us are most important, and we’re going to press for specifics. I am honored to have this role, but this evening belongs to the candidates and, just as important, to the American people. \\\n", " Candidates, we look forward to hearing you articulate your policies and your positions, as well as your visions and your values. So, let’s begin. \\\n", " We’re calling this opening segment “Achieving Prosperity.” And central to that is jobs. There are two economic realities in America today. There’s been a record six straight years of job growth, and new census numbers show incomes have increased at a record rate after years of stagnation. However, income inequality remains significant, and nearly half of Americans are living paycheck to paycheck. \\\n", " Beginning with you, Secretary Clinton, why are you a better choice than your opponent to create the kinds of jobs that will put more money into the pockets of American workers? \\\n", " CLINTON: Well, thank you, Lester, and thanks to Hofstra for hosting us. \\\n", " The central question in this election is really what kind of country we want to be and what kind of future we’ll build together. Today is my granddaughter’s second birthday, so I think about this a lot. First, we have to build an economy that works for everyone, not just those at the top. That means we need new jobs, good jobs, with rising incomes. \\\n", " I want us to invest in you. I want us to invest in your future. That means jobs in infrastructure, in advanced manufacturing, innovation and technology, clean, renewable energy, and small business, because most of the new jobs will come from small business. We also have to make the economy fairer. That starts with raising the national minimum wage and also guarantee, finally, equal pay for women’s work. \\\n", " I also want to see more companies do profit-sharing. If you help create the profits, you should be able to share in them, not just the executives at the top. \\\n", " And I want us to do more to support people who are struggling to balance family and work. I’ve heard from so many of you about the difficult choices you face and the stresses that you’re under. So let’s have paid family leave, earned sick days. Let’s be sure we have affordable child care and debt-free college. \\\n", " How are we going to do it? We’re going to do it by having the wealthy pay their fair share and close the corporate loopholes. \\\n", " Finally, we tonight are on the stage together, Donald Trump and I. Donald, it’s good to be with you. We’re going to have a debate where we are talking about the important issues facing our country. You have to judge us, who can shoulder the immense, awesome responsibilities of the presidency, who can put into action the plans that will make your life better. I hope that I will be able to earn your vote on November 8th. \\\n", " HOLT: Secretary Clinton, thank you. \\\n", " Mr. Trump, the same question to you. It’s about putting money—more money into the pockets of American workers. You have up to two minutes. \\\n", " TRUMP: Thank you, Lester. Our jobs are fleeing the country. They’re going to Mexico. They’re going to many other countries. You look at what China is doing to our country in terms of making our product. They’re devaluing their currency, and there’s nobody in our government to fight them. And we have a very good fight. And we have a winning fight. Because they’re using our country as a piggy bank to rebuild China, and many other countries are doing the same thing.\"" ] }, { "cell_type": "code", "execution_count": 55, "metadata": {}, "outputs": [], "source": [ "def remove_speakers(text, *names):\n", " '''\n", " INPUT: Transcript of debate\n", " PURPOSE: Remove the specified names from the transcript.\n", " OUTPUT: Text of the responses without speaker names interpolated.\n", " '''\n", " import re\n", " speakers = \"\".join([name.upper() + \":|\" for name in names])\n", " regex = re.compile(fr\"{speakers}(.+?)\")\n", " matches = [group for group in regex.findall(text) if group]\n", " matches = \"\".join(matches)\n", " return matches" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "' Good luck to you. [applause] Well, I don’t expect us to cover all the issues of this campaign tonight, but I remind everyone, there are two more presidential debates scheduled. We are going to focus on many of the issues that voters tell us are most important, and we’re going to press for specifics. I am honored to have this role, but this evening belongs to the candidates and, just as important, to the American people. Candidates, we look forward to hearing you articulate your policies and your positions, as well as your visions and your values. So, let’s begin. We’re calling this opening segment “Achieving Prosperity.” And central to that is jobs. There are two economic realities in America today. There’s been a record six straight years of job growth, and new census numbers show incomes have increased at a record rate after years of stagnation. However, income inequality remains significant, and nearly half of Americans are living paycheck to paycheck. Beginning with you, Secretary Clinton, why are you a better choice than your opponent to create the kinds of jobs that will put more money into the pockets of American workers? Well, thank you, Lester, and thanks to Hofstra for hosting us. The central question in this election is really what kind of country we want to be and what kind of future we’ll build together. Today is my granddaughter’s second birthday, so I think about this a lot. First, we have to build an economy that works for everyone, not just those at the top. That means we need new jobs, good jobs, with rising incomes. I want us to invest in you. I want us to invest in your future. That means jobs in infrastructure, in advanced manufacturing, innovation and technology, clean, renewable energy, and small business, because most of the new jobs will come from small business. We also have to make the economy fairer. That starts with raising the national minimum wage and also guarantee, finally, equal pay for women’s work. I also want to see more companies do profit-sharing. If you help create the profits, you should be able to share in them, not just the executives at the top. And I want us to do more to support people who are struggling to balance family and work. I’ve heard from so many of you about the difficult choices you face and the stresses that you’re under. So let’s have paid family leave, earned sick days. Let’s be sure we have affordable child care and debt-free college. How are we going to do it? We’re going to do it by having the wealthy pay their fair share and close the corporate loopholes. Finally, we tonight are on the stage together, Donald Trump and I. Donald, it’s good to be with you. We’re going to have a debate where we are talking about the important issues facing our country. You have to judge us, who can shoulder the immense, awesome responsibilities of the presidency, who can put into action the plans that will make your life better. I hope that I will be able to earn your vote on November 8th. Secretary Clinton, thank you. Mr. Trump, the same question to you. It’s about putting money—more money into the pockets of American workers. You have up to two minutes. Thank you, Lester. Our jobs are fleeing the country. They’re going to Mexico. They’re going to many other countries. You look at what China is doing to our country in terms of making our product. They’re devaluing their currency, and there’s nobody in our government to fight them. And we have a very good fight. And we have a winning fight. Because they’re using our country as a piggy bank to rebuild China, and many other countries are doing the same thing.'" ] }, "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ "remove_speakers(text, 'holt', 'trump', '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.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }