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.
Løsning
Takk for tilbakemeldingene dine!
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Fantastisk!
Completion rate forbedret til 8.33
Challenge: Fuzzy Match Product Names
Sveip for å vise menyen
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.
Løsning
Takk for tilbakemeldingene dine!
single