File size: 716 Bytes
38abf05
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import spacy

nlp = spacy.load('en_core_web_lg')

doc = nlp(u"Harry Potter star Daniel Radcliffe gets £20M fortune as he turns 18 Monday . Young actor says he has no plans to fritter his cash away . Radcliffe's earnings from first five Potter films have been held in trust fund .")
for entity in doc.ents:
  print(entity.label_, ' | ', entity.text)
  
doc = nlp(u"Mentally ill inmates in Miami are housed on the 'forgotten floor' Judge Steven Leifman says most are there as a result of 'avoidable felonies' While CNN tours facility, patient shouts: 'I am the son of the president' Leifman says the system is unjust and he's fighting for change .")
for entity in doc.ents:
  print(entity.label_, ' | ', entity.text)