How to access dictionary elements value from a Dictionary(Dictionary elements are dictionary itself)

81 Views Asked by At

I have tokenized sentences from texts. Now on each tokenized sentences, I applied Senna Semantic Role Labeling. annotation.getAnnotations("He created the Robot")['srl'] is the function that returns a dictionary like [{'A1': 'the Robot', 'A0': 'He', 'V': 'created'}] in D dictionary, single elements like A1 can be accessed using D[0]['A1'].

Now when assign this dictionary elements with a key as dictionary elements to another dictionary, then how can this dictionary elements be accessed with another dictionary. I have tried for multiple sentences in a loop for making it meaningful.

 j=0
 for i in tokenized_sentences:
     srl[j]= ann.getAnnotations(i)['srl']
     print(srl[j][0]['A0'])   # **not working, improvements can be here**
     j=j+1

I think this is not so tough questions, all that need to know the syntax and implementation. But I found no help in the internet.

0

There are 0 best solutions below