Here is the list which includes tags to the word type
t = [('The','OTHER'),('name','OTHER'),('is','OTHER'),('Wall','ORGANIZATION'),('Mart','ORGANIZATION'),('and','OTHER'),('Thomas','ORGANIZATION'),('Cook','ORGANIZATION')]
The expectation is to conditionally check if the subsequent tuple is tagged as organization if so concatenate them with a space and continue with the same over the entire list.
Expected output:
Wall Mart, Thomas Cook
for x in t:
if(x[1] == 'ORGANIZATION'):
org_list = org_list + ' | ' + x[0]
I was just able to extract the names but not really getting a way where I could concatenate the words tagged as organization.
Refereed to other Question asked: [Link]Concatenate elements of a tuple in a list in python
Expected output: Wall Mart, Thomas Cook