Question: Please provide Python code to answer the following questions, please don't use handwriting code, thank you # use Penn Treebank P.O.S for POS Tagging import
Please provide Python code to answer the following questions, please don't use handwriting code, thank you
# use Penn Treebank P.O.S for POS Tagging import nltk from nltk import word_tokenize from nltk.corpus import brown
# Question 20: use given words like BTWords (Brown corpus tagged words) or sample text # 20.a: Print the first 5 words from an alphabetically sorted list of the distinct words tagged as MD. (MD == Modal) BTWords = nltk.corpus.brown.tagged_words() ModalWords = [w for (w, t) in BTWords if t == 'MD'] sorted(set(ModalWords))[:5]
# 20.c: Identify three-word prepositional phrases of the form IN + DT + NN (e.g., in the lab) using raw_sent sentence. # Note: Textbook says DET, but current Brown corpus uses DT instead. # need to tokenize first, POS Tag and trigram. # see an example:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
