M
M
mazhigali2018-01-28 21:54:42
Python
mazhigali, 2018-01-28 21:54:42

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

2 answer(s)
X
xmoonlight, 2018-01-29
@xmoonlight

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 ...

A
al_gon, 2018-01-28
@al_gon

Approximate string matching
Did you solve a similar problem in the Service for checking for being on the sanctions list?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question