Actually I have 2 list, one which has some terms(100k+) and the other list with brand names(10k+) in it. I want to fetch only those terms which has a brand name associated to it. For eg:
terms=['chocolates','nestle chocolates','bar','cadbury bar','refrigerator','samsung refrigerator','era clothing','grilling machine']
brands=['imperial brand','gems','era','cadbury','samsung','nestle','grill']
my code-->
matching = [t for t in terms if any(bt in t for bt in brands)]
Expected Output-->
['nestle chocolates','cadbury bar','samsung refrigerator', 'era clothing']
My output-->
['nestle chocolates',
'cadbury bar',
'refrigerator',
'samsung refrigerator',
'era clothing',
'grilling machine']
I don't want terms like refrigerator or grilling machine to be a part of my list since these doesn't contain any brand names but they pop up in the list because of ERA n GRILL.
Can someone please help to achieve this.