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.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Incrível!
Completion taxa melhorada para 8.33
Challenge: Fuzzy Match Product Names
Deslize para mostrar o menu
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.
Solução
Obrigado pelo seu feedback!
single