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]: #](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4ef7c3ab73_12366f4ef7bafdce.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 1 Extract all named entities as well as its type/label In [7]: # Exercisei, define a function to extract all named enties together with Labels def get_labeled_chunks (text): # your implementation return label_entities get_labeled_chunks (raw) Out[7]: {'John': 'PERSON', 'Liverpool': 'GPE', 'Julia': 'GPE', 'Alfred Lennon': 'PERSON'}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
