PIXELBANKv8.2.1
Menu

Embedding Lookup

Given a simple embedding table (word-to-vector mapping) and a list of words, look up each word's embedding vector and return the average embedding.

Input format:

  • Line 1: Number of entries in embedding table
  • Next n lines: word followed by comma-separated floats (e.g., "cat 0.1,0.2,0.3")
  • Last line: Space-separated words to look up

If a word is not in the table, skip it. Round each dimension of the result to 4 decimal places.

Example:

Input:
3
cat 1.0,0.0
dog 0.0,1.0
fish 0.5,0.5
cat dog
Output:
[0.5, 0.5]
Reasoning:

Step 1: Build embedding table cat → [1.0, 0.0], dog → [0.0, 1.0], fish → [0.5, 0.5]

Step 2: Look up words cat → [1.0, 0.0], dog → [0.0, 1.0]

Step 3: Average [(1.0+0.0)/2, (0.0+1.0)/2] = [0.5, 0.5]

Constraints:

  • 1 ≤ n ≤ 20
  • Embedding dimensions are consistent
  • At least one lookup word will be in the table
  • Output: List of floats rounded to 4 decimal places
Editor

Test Results

0/0
Run code to see test results.