I have a huge list of dictionaries with data labeled as follows
{'id': 2,
'text': '"The hotel has many restaurants to enjoy a meal. My husband and I went to the Japanese restaurant and we only found sushi. Considering that it is an international hotel, they should have a larger variety of options.',
'label': [[0, 46, 'general services'], [47, 214, 'japanese food']]},
And I want to create the next output, split the sentence and put the label in front of it, like this.
The hotel has many restaurants to enjoy a meal , general services.
My husband and I went to the Japanese restaurant and we only found sushi. Considering that it is an international hotel, they should have a larger variety of options, japanese food
I used the code:
for x in data[2]['label']:
print(data[2]['text'][x[0]:x[1]],x[2])
But I want to generalize this, for the whole data set. I really would appreciate your help.