<jupyter_start><jupyter_text>Data Analysis -- Measuring Coronavirus Word Choice and Messaging Focus -- Keyness Analysis  The sentiment and KWIC analyses I conducted delved into and revealed an important difference between Fox's and CNN's coronavirus response: consistency. Another important difference between Fox's and CNN's coronanvirus response could be their word choice and vocabulary, and their overall messaging from a content perspective. Keyness analysis is one tool that can help provide insight into this. Keyness Analysis is a statistical tool that is often used in order to identify significant differences between 2 corpora. Essentially, Keyness Analysis compares the normalized frequencies of linguistic items in two corpora. Keyness Analysis normalizes frequencies of linguistic items by scaling the raw frequency of an item in a text/corpus by the size of the text/corpus.  In this project, I used Keyness Analysis to compare normalized word frequencies between Fox and CNN news broadcasts, comparing word frequencies in CNN news broadcasts to those in Fox news broadcasts and vice versa. This will help provide me with insights into the vocabulary, word choice, and messaging differences that exist between the two news outlets' coronavirus responses. It will help me focus on which words in particular differ between Fox and CNN, which vocabulary differences are meaningful, and how messaging differs between Fox and CNN from a content perspective as a result of this. This will also help to extend KWIC analysis, by drawing insights about each news outlet's overall messaging between January and April, as opposed to focusing more granularly on certain months, the differences between messaging within certain months and between them, and messaging consistency.<jupyter_code>%run data_processing.ipynb<jupyter_output>[nltk_data] Downloading package vader_lexicon to
[nltk_data]     /Commjhub/jupyterhub/comm318_fall2019/jdlish/nltk_data
[nltk_data]     ...
[nltk_data]   Package vader_lexicon is already up-to-date!<jupyter_text>Setting Up Keyness Analysis<jupyter_code>flattened_tokens_cnn = []

#flatten the list
for i in range(len(data_cnn['targeted text'])):
    toks=tokenize(data_cnn['targeted text'][i],True,strip_chars=strip_chars)
    for y in toks:
        flattened_tokens_cnn.append(y)
        
flattened_tokens_fox = []

#flatten the list
for i in range(len(data_fox['targeted text'])):
    toks=tokenize(data_fox['targeted text'][i],True,strip_chars=strip_chars)
    
    for y in toks:
        flattened_tokens_fox.append(y)
CNN_words=Counter(flattened_tokens_cnn)
Fox_words=Counter(flattened_tokens_fox)
import math
cnn_vs_fox=calculate_keyness(CNN_words, Fox_words,print_table=False)
cnn_vs_fox.columns=["CNN Word","CNN Word Frequency","Fox Word Frequency","Keyness CNN vs. Fox"]
fox_vs_cnn=calculate_keyness(Fox_words, CNN_words,print_table=False)
fox_vs_cnn.columns=["Fox Word","Fox Word Frequency","CNN Word Frequency","Keyness Fox vs. CNN"]
combined_keyness=pd.concat([cnn_vs_fox.reset_index(drop=True), fox_vs_cnn.reset_index(drop=True)], axis=1)
combined_keyness.iloc[1:25]<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup