Code RoomChatbot fuzzy token match
MediumPrep Room Coding #542

Chatbot fuzzy token match

CodingML systemsEntry–Mid~16 min

Exact match is too strict for chatbot answers, so your eval also scores fuzzy token matches. For each output/reference pair: lowercase both strings and split them on whitespace into tokens. Take the reference's distinct tokens; count how many of them appear among the output's tokens (hits). The pair matches when 100 * hits >= threshold_pct * distinct_count, using integer arithmetic. A reference with no tokens always matches. Given equal-length lists outputs and references plus an integer threshold_pct, return the number of matching pairs. Example: outputs = ["the capital of france is paris"], references = ["paris france"], threshold_pct = 100 returns 1.

Implement
fuzzy_match_count(outputs: list[str], references: list[str], threshold_pct: int) → int
Examples
in[["the capital of france is paris"],["paris france"],100]out1
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 16 min
InputExpectedGot
[["the capital of france is paris"],["paris france"],100]1not run yetsample