I’m running into the following error. Can someone help?
KeyError Traceback (most recent call last)
in
25 print("\033[92mAll tests passed!")
26
—> 27 sentence_to_avg_test(sentence_to_avg)
28
29 # END UNIT TEST
in sentence_to_avg_test(target)
16 assert tuple(avg.shape) == tuple(word_to_vec_map[‘a’].shape), “Check the shape of your avg array”
17 assert np.allclose(avg, [1.25, 2.5]), “Check that you are finding the 4 words”
—> 18 avg = target(“love a a_nw c_w a_s”, word_to_vec_map)
19 assert np.allclose(avg, [1.25, 2.5]), “Divide by count, not len(words)”
20 avg = target(“love”, word_to_vec_map)
in sentence_to_avg(sentence, word_to_vec_map)
37 # Check that word exists in word_to_vec_map
38 if w in words:
—> 39 avg += word_to_vec_map[w]
40 # Increment count
41 count +=1
KeyError: ‘love’