Answered step by step
Verified Expert Solution
Question
1 Approved Answer
So the task is to fulfill the POS_tag (sentence) method. I got stuck with tokenisation and the steps onward. pip3 install nltk You may also
So the task is to fulfill the POS_tag (sentence) method.
I got stuck with tokenisation and the steps onward.
pip3 install nltk You may also need to download some extra data: >>> import nltk >>> nltk.download ('stopwords') >>> nltk.download ('punkt') >>> nltk.download ('averaged_perceptron_tagger') Implement the POS_tag (sentence) function which takes in a string and return the Part-of-Speech(POS) tag of each word in the sentence. To complete this task, you need to fulfill the requirements shown below: 1) Convert all the characters in the sentence to lower case. 2) Tokenize the sentence. 3) Remove the stop words and punctuation. 4) Conduct the pos tagging and return a list of tuples. Here is a test case: >>> import nltk >>> sentence = 'The Force will be with you. Always.' >>> POS_tag(sentence) [('force', 'NN'), ('always', 'RB')]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started