Spot weak questions with rules
The retriever here counts shared content words over all twelve handbook passages (stop words ignored). The point is the flags column, not the retriever.
The index was built carefully, but the question is whatever the user typed: short, vague, misspelt, or pointing back at something said earlier. A retriever can only compare the text it is given, so a weak question beats a strong index.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write blind(questions, docs) that returns the questions sharing no content word with any document. Ignore the stop words {"i", "the", "a", "do", "how", "my"}. Print the blind questions for three questions of your own over two short documents.
Write looks_weak(question) returning True when the question has at most one content word or contains a pointer word (it, that, one). Print yes or no for four questions.
Explain it without notes
Why can a perfect index still return the wrong passage?
Name the five ways a question can be weak and give an example of each.
Why does a weak question often look like a working one?
Why do cheap rules come before model calls in a query layer?
Expected output
question best hit problems
What does the monthly pass cost? D8 (2) ok
hours D1 (1) short
refund none short, unknown: refund
pasword rest none unknown: pasword rest
Can I get my money back if I cancel? none unknown: back cancel money
what about it? none short, points back
What about the second one? D4 (1) points back, unknown: second