Answer the question
In order to leave comments, you need to log in
How to isolate a product, brand and modifications from a line?
Please tell me using python how to extract data from a string.
For example, there is a line "BARBERI Pump group with mixer 1 without pump"
In this line "barberi" is a brand, "pump group" is a product, "with mixer 1 without pump" is a product modification.
The main task: is to put the word with the brand after the product name.
Regular is not an option, because. the brand can be from 2 words and in Russian too, also with the names of the goods.
Answer the question
In order to leave comments, you need to log in
1. Compile a dictionary (one-to-many): brand -> brand products
2. Through fuzzy search ( search for a substring with an arbitrary ending ), we find the desired string and the right side will be a modification of the product.
3. Set the desired order of 3 parts: brand, brand product, modification.
PS: I advise you to form such things dynamically based on data from the database from different columns, so as not to encounter this again ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question