Course 5 Week 2 pair input to word_to_vec_map

I’ve been using dictionaries for a few months now and just got my first error that I can’t resolve.

—> 17 w1, w2 = word_to_vec_map[pair]
18 e_w1, e_w2 = word_to_vec_map[e_w1], word_to_vec_map[e_w2]

KeyError: (‘man’, ‘woman’)

Any suggestions?

What is the value of “pair”?

It is the input argument that is a “pair of strings of gender specific words to debias, e.g. (“actress”, “actor”).”

A dictionary only works on single words, not pairs.
So in this line of code:
w1, w2 = word_to_vec_map[pair]
…you can’t use word_to_vec_map[…].

Just use “w1, w2 = pair”, then in the next line of code, use word_to_vec_map[…] on each word.

I can’t believe I didn’t catch that. Thanks.