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 all packages import nltk from nltk import word_tokenize, pos_tag, ne_chunk from

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 3: Noun phrase chunking Define your own grammer for noun phrase chunking using nltk. RegexpParser In [10]: def np_chunking (sentence): grammer = "NP: {+}" # chunker rule(s), try think of more rules # your implementation return entity print(np_chunking("""the little dog barked at the cat""")) print(np_chunking("""Jonh was born in Liverpool, to Julia and Alfred Lennon""")) ['little dog', 'cat'] ['Jonh', 'Liverpool', 'Julia', 'Alfred Lennon']

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!