<commit_before>---
layout: post
title: "Sentiment Analysis of the Oct 10 2016 Presidential Debate"
modified: 
categories: blog
excerpt:
tags: [debate]
image:
feature:
date: 2016-10-12T08:08:50-04:00
---

### SUMMARY   
What can we learn about a debate and it's outcome from a "sentiment" analysis? This analysis focuses on the sentiment trend of the second of three 2016 Presidential Election Debates between <NAME> and <NAME>. 

### DATA SOURCES AND METHODS   
The text of the debate are downloaded from the [UCSB Presidency Project](http://www.presidency.ucsb.edu/debates.php). Transcripts were cut from the web page, pasted into Apple Pages, and, without editing, stored as unformatted .txt files.   

The .txt files are made tidy by a separate __.R__ program which cleans the text by removing punctuation and annotation and then categorizes by speaker. In practice this reduction required substantial fine tuning, so the program is stored as part of the analysis. The tidy data are stored as a .csv file which contains three columns:
1. An index demarcating each text fragement.  
2. The speaker's name.  
3. The actual text.  


| X   | name       | text |
|:----|:----------:|--------:|
| 1   | RADDATZ    | ladies and gentlemen the republican nominee... |
| 2   | COOPER     | thank you very much for being here we re going to begin with a question... |
| 3   | AUDIENCE   | thank you and good evening the last debate could have been rated as mature... |
| 5   | CLINTON    | well thank you are you a teacher yes i think that that s a very good question... |
|=====
| 447   | RADDATZ  | please tune in on october th for the final presidential debate   |
{: .table}

          
1 1  RADDATZ    ladies and gentlemen the republican nominee...
2 2   COOPER    thank you very much for being here we re going to begin with a question...
3 3 AUDIENCE    thank you and good evening the last debate could have been rated as mature...
4 4  CLINTON    well thank you are you a teacher yes i think that that s a very good question...
5 5  CLINTON    and i think it is very important for us to make clear to our children ...




The analysis follows methods hightlighted in recent posts by [<NAME>son](http://varianceexplained.org/r/trump-tweets/) and [<NAME>](http://juliasilge.com/blog/Life-Changing-Magic/).

The methods are similar to a [previous post on the VP debates](http://rpubs.com/ww44ss/vp_debate), so I have suppressed most of the code from this printout.


### ANALYSIS   
<commit_msg>table format<commit_after>---
layout: post
title: "Sentiment Analysis of the Oct 10 2016 Presidential Debate"
modified: 
categories: blog
excerpt:
tags: [debate]
image:
feature:
date: 2016-10-12T08:08:50-04:00
---

### SUMMARY   
What can we learn about a debate and it's outcome from a "sentiment" analysis? This analysis focuses on the sentiment trend of the second of three 2016 Presidential Election Debates between <NAME> and <NAME>. 

### DATA SOURCES AND METHODS   
The text of the debate are downloaded from the [UCSB Presidency Project](http://www.presidency.ucsb.edu/debates.php). Transcripts were cut from the web page, pasted into Apple Pages, and, without editing, stored as unformatted .txt files.   

The .txt files are made tidy by a separate __.R__ program which cleans the text by removing punctuation and annotation and then categorizes by speaker. In practice this reduction required substantial fine tuning, so the program is stored as part of the analysis. The tidy data are stored as a .csv file which contains three columns:
1. An index demarcating each text fragement.  
2. The speaker's name.  
3. The actual text.  


| X   | name       | text |
|:---:|-----------:|:--------|
| 1   | RADDATZ    | ladies and gentlemen the republican nominee... |
| 2   | COOPER     | thank you very much for being here we re going to begin with a question... |
| 3   | AUDIENCE   | thank you and good evening the last debate could have been rated as mature... |
| 5   | CLINTON    | well thank you are you a teacher yes i think that that s a very good question... |
|=====
| 447   | RADDATZ  | please tune in on october th for the final presidential debate   |
{: .table}

          
The analysis follows methods hightlighted in recent posts by [<NAME>](http://varianceexplained.org/r/trump-tweets/) and [<NAME>](http://juliasilge.com/blog/Life-Changing-Magic/).

The methods are similar to a [previous post on the VP debates](http://rpubs.com/ww44ss/vp_debate), so I have suppressed most of the code from this printout.


### ANALYSIS   

{'fraction_non_alphanumeric': 0.09002861545234427, 'fraction_numerical': 0.01981069777679947, 'mean_word_length': 3.278719397363465, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '925562', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1263, 'n_words': 637}