This code accompanies the white paper "Is the CBC a Neutral Voice in Canadian Politics?".
The final results used in the paper are in the data/results.csv
file.
Below is an explination of the main files. Note that mose code is written in python, except for get_chat_gpt_response.js
which is javascript. At time of writting, OpenAI does not have a API for ChatGPT the most convenient workaround was to use a javascript library. There is also the option of using text-davinci-003
which produces very similar results to ChatGPT.
get_article_links.py
will grab article links from Google News RSS feed for articles published on cbc.ca/news and save them todata/links
folderget_articles.py
will scrape cbc.ca/news site for the full articles and save them todata/articles.csv
extract_snippets.py
will extract the article excerpts used for feeding into ChatGPTclassify_articles.py
will querytext-davinci-003
for classifying articles and save results todata/results.csv
. To query ChatGPT instead, use node to runget_chat_gpt_response.js
, this is not 100% complete as it will nto save to csv, instead print responses to console. This will be updated once an official API is released for ChatGPT.
White Paper- Is the CBC a neutral voice in Canadian politics? - Alex Vukadinovic.pdf