A model can learn a short list of numbers for every word, so that words with similar meanings sit close together (“Invent the score”). Write complete(a, b, c, vectors): “a is to b as c is to ?”, like “man is to king as woman is to ?”. vectors maps every word to its numbers. Return a word.
A model learned two numbers for every word, so each word is a point on a map. Your function gets three words of an analogy and the map, and hands back the word that completes it.
complete(a, b, c, vectors)| a | words: a is to b as c is to ? | e.g. "man" |
| b | words: a is to b as c is to ? | e.g. "king" |
| c | words: a is to b as c is to ? | e.g. "woman" |
| vectors | {"man": [1.0, 1.0], "king": [4.0, 1.0], ...} | e.g. {"man", "woman", "king", "queen", …} |
| returns | a word: the closest word to c | |