function get_neighborhood_words_across_decades(word, num_neighbors) {
var word_index = swapped_words[word];
var neighborhood_dict = {}
var decades = [...Array(21).keys()].map(i => 2000 - i*10)
for (const dec of decades) {
var neighbors = word_neighborhoods_full[dec+"_neighbors"][word_index];
var similarities = word_neighborhoods_full[dec+"_cosine"][word_index];
neighbors = neighbors.slice(0, num_neighbors);
similarities = similarities.slice(0, num_neighbors);
var neighb_i
for (neighb_i = 0; neighb_i < neighbors.length; neighb_i++) {
const neighb = neighbors[neighb_i]
const sim = similarities[neighb_i]
if (!(neighb in neighborhood_dict)) {
neighborhood_dict[neighb] = {}
}
neighborhood_dict[neighb][dec] = sim
}
}
for (const neighb in neighborhood_dict) {
for (const dec of decades) {
if (!(dec in neighborhood_dict[neighb])) {
neighborhood_dict[neighb][dec] = -2.
}
}
}
return neighborhood_dict
}