spacy中文实体识别

在用annotations时,有一行总是报错,'tuple' object has no attribute 'get'哪位能帮忙看看,万分感谢

 for ent in annotations.get('entities'):
        ner.add_label(ent[2])


TRAIN_DATA = (“Higher School Certificate, Parramatta Marist High School, Westmead (1998)”,{“entities”:[(0,25,”degree”),(27,56,”school_name”),(58,66,”location”),(68,72,”date”)]}),

(“Bachelor of Business, University of Western Sydney (2005) “,{“entities”:[(0,20,”degree”),(22,43,”school_name”),(44,50,”location”),(52,56,”date”)]}),

(“20072010 BCA (Bachelor of Computer Application) from Khalsa college for women, Amritsar (Affiliated to Guru Nanak Dev University (G.N.D.U) India “,{“entities”:[(0,9,”date”),(12,50,”degree”),(54,78,”school_name”),(80,88,”location”)]}),

(“20102013 MCA (Masters in Computer Applications) from Amritsar College of Engineering, Amritsar (Affiliated to Punjab Technical University (P.T.U) India. “,{“entities”:[(0,9,”date”),(10,48,”degree”),(54,85,”school_name”),(87,95,”location”)]})

```

你的TRAIN_DATA加个[]如下所示,你可以先跑下下面的看是否一样OK:

TRAIN_DATA = [
    ('Who is Shaka Khan?', {
        'entities': [(7, 17, 'PERSON')] 
    }),
    ('I like London and Berlin.', {
        'entities': [(7, 13, 'LOC'), (18, 24, 'LOC')]
    })
]
for _, annotations in TRAIN_DATA:
        for ent in annotations.get('entities'):
            print('hello !')

img