Question
Please answer following questions along with Python code and its result. Make sure to import NLTK. Read in the texts of the State of the
Please answer following questions along with Python code and its result. Make sure to import NLTK.
Read in the texts of the State of the Union addresses, using the state_union corpus reader. Count occurrences of men, women, and people in each document. What has happened to the usage of these words over time?
Hint: use nltk.ConditionalFreqDist
from nltk.corpus import state_union
state_union.fileids()
# The first 4 digits stand for year.
[fileid[:4] for fileid in state_union.fileids()]
cfd = nltk.ConditionalFreqDist(
fill the rest please delete this line
Define a conditional frequency distribution over the Names Corpus that allows you to see which initial letters are more frequent for males versus females (see Figure 2-7). (4 points)
a. Show the code to get the cfd
b. Draw plot and tell which (capital) letter starts with males names mostly from the plot.
c. List males name which starts with the letter from b.
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