September 2018
Intermediate to advanced
472 pages
12h 2m
English
The goal of NER is to recognize tokens associated with people, organizations, and locations. Let's use an example to explain it further:
In: import nltk text = "Elvis Aaron Presley was an American singer and actor. Born in \ Tupelo, Mississippi, when Presley was 13 years old he and his \ family relocated to Memphis, Tennessee." chunks = nltk.ne_chunk(nltk.pos_tag(nltk.word_tokenize(text))) print (chunks)Out: (S (PERSON Elvis/NNP) (PERSON Aaron/NNP Presley/NNP) was/VBD an/DT (GPE American/JJ) singer/NN and/CC actor/NN ./. Born/NNP in/IN (GPE Tupelo/NNP) ,/, (GPE Mississippi/NNP) ,/, when/WRB (PERSON Presley/NNP) was/VBD 13/CD years/NNS old/JJ he/PRP and/CC his/PRP$ family/NN relocated/VBD ...
Read now
Unlock full access