Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Search Query Parser With Synonyms
00:00
5 left

Search Query Parser With Synonyms

HardPython

Problem

Implement a basic search query parser that matches candidate skills against job description keywords, handling synonyms and spelling variations for Manpower Belgium.

Use def match_candidates(query_keywords, candidates, synonyms):. Return candidate names in their original order when at least one requested keyword matches a skill. Matching is case-insensitive, ignores surrounding or repeated whitespace, treats listed synonyms as equivalent, and allows a Levenshtein distance of at most one. Each candidate has a name and a skills list; synonyms maps canonical terms to equivalent variations.

Constraints

  • 1 <= len(candidates) <= 1000
  • 0 <= len(query_keywords) <= 100
  • Each candidate has a unique name and a skills list
  • Each query keyword and skill is a non-empty string of at most 100 characters
  • The synonym mapping contains canonical terms and lists of equivalent variations
  • A match requires canonical equality or Levenshtein distance at most one

Function Signature

def match_candidates(query_keywords, candidates, synonyms):
Interviewer

Your question is Search Query Parser With Synonyms. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.