To utilise all functions we created in previous tasks, we are going to make a function that would interact with users. Write a function tweet_analysis (), which does the following:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
To utilise all functions we created in previous tasks, we are going to
make a function that would interact with users. Write a function
tweet_analysis (), which does the following:
1. Ask for user input of the input filename with message: 'Enter the
name of the file to read: '
2. Ask for user input of the output filename with message: 'Enter the
name of the file to write: '
3. Ask for user input of the stopwords with message: 'Enter your
stopwords: '
4. Ask for user input of the punctuations with message: 'Enter your
punctuations to remove: '
5. Load the file from the input file from step 1.
6. For each line from the given file, process
1. Capitalisation
2. Remove stopwords as given in step 3.
3. Remove punctuations as given in step 4.
4. Remove duplicate words
5. Remove noises
6. Stem words
7. Write the resulting sentences to the output file from step 2.
8. Save the resulting sentences to a list
9. Return the saved resulting sentences
Transcribed Image Text:To utilise all functions we created in previous tasks, we are going to make a function that would interact with users. Write a function tweet_analysis (), which does the following: 1. Ask for user input of the input filename with message: 'Enter the name of the file to read: ' 2. Ask for user input of the output filename with message: 'Enter the name of the file to write: ' 3. Ask for user input of the stopwords with message: 'Enter your stopwords: ' 4. Ask for user input of the punctuations with message: 'Enter your punctuations to remove: ' 5. Load the file from the input file from step 1. 6. For each line from the given file, process 1. Capitalisation 2. Remove stopwords as given in step 3. 3. Remove punctuations as given in step 4. 4. Remove duplicate words 5. Remove noises 6. Stem words 7. Write the resulting sentences to the output file from step 2. 8. Save the resulting sentences to a list 9. Return the saved resulting sentences
Note: using previously implemented functions, this task should be
straightforward!
Note2: You can assume all previous functions are correctly implemented
for you using sample answers, so you only have to submit the
tweet_analysis function here.
Note3: based on the above 2 notes, you should understand that you are
not supposed to cram all previously implemented code into this
function, but just call them.
Note4: if you come across errors like /x9d, then you should specify the
filing writing with encoding="utf-8".
Transcribed Image Text:Note: using previously implemented functions, this task should be straightforward! Note2: You can assume all previous functions are correctly implemented for you using sample answers, so you only have to submit the tweet_analysis function here. Note3: based on the above 2 notes, you should understand that you are not supposed to cram all previously implemented code into this function, but just call them. Note4: if you come across errors like /x9d, then you should specify the filing writing with encoding="utf-8".
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY