Command Palette

Search for a command to run...

Hectal
Phase 7: Query Understanding
RAG and Vector Search · Exercise 1 of 6Next
Beginner

Rewrite a question with rules

Write rewrite_query(question, drop, fix) that lower-cases the question, splits it into runs of letters and digits, removes every word in drop, replaces words found in the dict fix, and joins the rest with single spaces.

A question that is all dropped words returns an empty string.

What Check tests

  1. Drops filler and fixes a typo
  2. Lower-cases and drops punctuation
  3. Nothing to drop, nothing to fix
  4. All words dropped gives an empty string
  5. Fixes are applied after dropping

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.