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.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Чудово!
Completion показник покращився до 8.33
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.
Рішення
Дякуємо за ваш відгук!
single