Intermediate
MaxSim by hand
Vectors are tuples of two numbers. Write dot(a, b) and maxsim(query, doc).
query and doc are lists of vectors. maxsim returns, for each query vector, its highest dot product with any vector of doc, added up over the query vectors.
What Check tests
- dot multiplies and adds
- An exact cover scores the number of query tokens
- A passage covering one query token scores less
- The best partner is used, not the sum
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.