Я пытаюсь извлечь страны из адресов организации, используя пространственный NER, однако он помечает страны и города одинаковым тегом GPE
. Можно ли как-то их различить?
, например:
nlp = en_core_web_sm.load()
doc= nlp('Resilience Engineering Institute, Tempe, AZ, United States; Naval Postgraduate School, Department of Operations Research, Monterey, CA, United States; Arizona State University, School of Sustainable Engineering and the Built Environment, Tempe, AZ, United States; Arizona State University, School for the Future of Innovation in Society, Tempe, AZ, United States')
for ent in doc.ents:
if ent.label_ == 'GPE':
print(ent.text)
возвращает
Tempe
AZ
United States
United States
Tempe
AZ
United States
Tempe
AZ
United States