Challenge: Fuzzy Match Product Names
Swipe to start coding
You are given two lists of product names:
catalog_names— the official catalog entries;incoming_names— names provided by an external supplier with slight variations.
Your goal is to assign each supplier product name to the closest matching catalog name using the difflib library from the Python standard library.
Follow these steps:
- For each element of
incoming_names, compare it with every element ofcatalog_names. - Use the
SequenceMatcherclass from thedifflibmodule to calculate similarity scores. - For each incoming name, find the catalog entry with the highest similarity score.
- Store all matches in a dictionary named
matched_products, where keys are supplier names and values are the closest catalog names.
Make sure that the variable matched_products is declared and contains the correct matches.
Oplossing
Bedankt voor je feedback!
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Geweldig!
Completion tarief verbeterd naar 8.33
Challenge: Fuzzy Match Product Names
Veeg om het menu te tonen
Swipe to start coding
You are given two lists of product names:
catalog_names— the official catalog entries;incoming_names— names provided by an external supplier with slight variations.
Your goal is to assign each supplier product name to the closest matching catalog name using the difflib library from the Python standard library.
Follow these steps:
- For each element of
incoming_names, compare it with every element ofcatalog_names. - Use the
SequenceMatcherclass from thedifflibmodule to calculate similarity scores. - For each incoming name, find the catalog entry with the highest similarity score.
- Store all matches in a dictionary named
matched_products, where keys are supplier names and values are the closest catalog names.
Make sure that the variable matched_products is declared and contains the correct matches.
Oplossing
Bedankt voor je feedback!
single