Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
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 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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.