Question: Please fill the code below # your implementation In [1]: # import all packages import nltk from nltk import word_tokenize, pos_tag, ne_chunk from nltk import
![Please fill the code below # your implementation In [1]: # import](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4e39af26cf_08266f4e39a60659.jpg)
Please fill the code below # your implementation
In [1]: # import all packages import nltk from nltk import word_tokenize, pos_tag, ne_chunk from nltk import Tree II II II raw = In [2]: # Tokenize sentence: """John was born in Liverpool, to Julia and Alfred Lennon" tokens = word_tokenize(raw) tokens Exercise 2 Extract only PERSON entities In [8]: # Exercise2, extract all the entities of specific type def get_type_chunks (text, label): # your implementation return entity get_type_chunks (raw, 'PERSON') Out[8]: ['John', 'Alfred Lennon']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
