Question
Please provide Python codes to answer the following: # use Penn Treebank P.O.S for POS Tagging import nltk from nltk import word_tokenize from nltk.corpus import
Please provide Python codes to answer the following:
# use Penn Treebank P.O.S for POS Tagging import nltk from nltk import word_tokenize from nltk.corpus import brown
# Question 3: # Tokenize and tag using given sentence. # What different pronunciations and parts-of-speech are involved? MySentence = 'They wind back the clock, while we chase after the wind.'
# Question 10: # Train a unigram tagger and run it on some new text. Observe that some words are not assigned a tag. Why not? # Use brown corpus as training data MyText = 'Here put your favorite words'
# 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:
# Question 99: Among the number of automa9c taggers, the combined N-gram tagger with backoff technique is considered most cost effecive tagger. # Describe briefly each line of following code especially how each tagger works. t0 = nltk.DefaultTagger(NN') t1 = nltk.UnigramTagger(train_sents, backoff=t0) t2 = nltk.BigramTagger(train_sents, backoff=t1)
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