Я использовал NLTK-х ne_chunk
для извлечения именованных объектов из текста:NLTK Названное Распознавание объектов в список Python
my_sent = "WASHINGTON -- In the wake of a string of abuses by New York police officers in the 1990s, Loretta E. Lynch, the top federal prosecutor in Brooklyn, spoke forcefully about the pain of a broken trust that African-Americans felt and said the responsibility for repairing generations of miscommunication and mistrust fell to law enforcement."
nltk.ne_chunk(my_sent, binary=True)
Но я не могу понять, как сохранить эти объекты в список? Например. -
print Entity_list
('WASHINGTON', 'New York', 'Loretta', 'Brooklyn', 'African')
Спасибо.
Что делает 'ne_chunk()' вернуть вместо этого? Что именно вы застряли? – lenz
Возможный дубликат [Именованное распознавание сущностей с регулярным выражением: NLTK] (http://stackoverflow.com/questions/24398536/named-entity-recognition-with-regular-expression-nltk) – alvas
Когда я запускаю свой код, я получаю IndexError – MERose