habe ich NLTK ne_chunk
der aus einem Text benannten Entitäten zu extrahieren:NLTK Named Entity Anerkennung auf eine Python-Liste
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)
Aber ich kann nicht herausfinden, wie diese Entitäten zu einer Liste speichern? Z.B. -
print Entity_list
('WASHINGTON', 'New York', 'Loretta', 'Brooklyn', 'African')
Danke.
Was 'ne_chunk tut()' Rückkehr statt? Was genau stecken Sie fest? – lenz
mögliches Duplikat von [Named Entity Recognition mit regulärem Ausdruck: NLTK] (http://stackoverflow.com/questions/24398536/named-entity-recognition-withregular-expression-nltk) – alvas
Wenn ich Ihren Code ausführen, bekomme ich ein Indexfehler – MERose