Public
Edited
May 11, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
gh_path = "https://raw.githubusercontent.com/Datalab-AUTH/imedd-political-speech-data-test/main/pre-elections/"
Insert cell
gh_path_alldata = "https://raw.githubusercontent.com/Datalab-AUTH/imedd-political-speech-data-test/main/pre-elections-aggregate/"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// aggregate sentiment
async function get_avg_sentiment(politician, list_of_speeches) {
let pol_speeches = list_of_speeches[politician]
let temp_sentiment_list = []
for (let j=0; j<pol_speeches.length; j++){
let speech_sentiment = await fetch(gh_path+politician+"/"+pol_speeches[j][1]+"/analysis/visuals/sentiment.json").then((response) => response.json())
if (speech_sentiment !== null){
temp_sentiment_list.push(speech_sentiment)
}
}
return temp_sentiment_list.reduce((a, b) => a + b, 0) / temp_sentiment_list.length
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more