Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Business Report - Problem 2.docx

Rating
-
Sold
-
Pages
10
Grade
A+
Uploaded on
30-06-2023
Written in
2022/2023

Problem 2: In this particular project, we are going to work on the inaugural corpora from the nltk in Python. We will be looking at the following speeches of the Presidents of the United States of America: 1. President Franklin D. Roosevelt in 1941 2. President John F. Kennedy in 1961 3. President Richard Nixon in 1973  Find the number of characters, words and sentences for the mentioned documents.  Remove all the stopwords from all the three speeches.  Which word occurs the most number of times in his inaugural address for each president? Mention the top three words. (after removing the stopwords)  Plot the word cloud of each of the speeches of the variable. (after removing the stopwords) – Code Snippet to extract the three speeches: " import nltk oad('inaugural') from s import inaugural ds() ('1941-R') ('1961-K') ('1973-N') " Introduction: NLTK will provide you with everything from splitting paragraphs to sentences, splitting words, identifying the part of speech, highlighting themes, and even helping your machine understand what the text is about. Q1. Find the number of characters, words and sentences for the mentioned documents. Answer : We are importing the nltk library to use the s()

Show more Read less
Institution
Module

Content preview

Problem 2:
In this particular project, we are going to work on the inaugural corpora from the nltk in
Python. We will be looking at the following speeches of the Presidents of the United States
of America:
1. President Franklin D. Roosevelt in 1941
2. President John F. Kennedy in 1961
3. President Richard Nixon in 1973
 Find the number of characters, words and sentences for the mentioned documents.
 Remove all the stopwords from all the three speeches.
 Which word occurs the most number of times in his inaugural address for each
president? Mention the top three words. (after removing the stopwords)
 Plot the word cloud of each of the speeches of the variable. (after removing the
stopwords) –

Code Snippet to extract the three speeches:
"
import nltk
nltk.download('inaugural')
from nltk.corpus import inaugural
inaugural.fileids()
inaugural.raw('1941-Roosevelt.txt')
inaugural.raw('1961-Kennedy.txt')
inaugural.raw('1973-Nixon.txt')
"
Introduction:
NLTK will provide you with everything from splitting paragraphs to sentences, splitting words,
identifying the part of speech, highlighting themes, and even helping your machine
understand what the text is about.
Q1. Find the number of characters, words and sentences for the mentioned documents.
Answer : We are importing the nltk library to use the inaugural.fileds()




1|Page

, After importing the text file, we would first count the total number of characters in each file
separately. Below is the code to count the char from each file. With the output along with
the screenshot.
# number of Characters in each file




# Number of words in each text file:
Below we are counting the total number of words from each file separately.
Here we are using the split() to split up the words based on space between each word and
we are counting the total number of words by using the len() function.
Output :




2|Page

Written for

Module

Document information

Uploaded on
June 30, 2023
Number of pages
10
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
FaiFai

Get to know the seller

Seller avatar
FaiFai Harvard College
Follow You need to be logged in order to follow users or courses
Sold
4
Member since
2 year
Number of followers
2
Documents
145
Last sold
1 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions