(Text Analysi5) The availability of computers with string-manipulation capabilities has re- sulted in some rather interesting approaches to analyzing the writings of great authors. Much atten- tion has been focused on whether William Shakespeare ever lived. Some scholars find substantial evidence that Christopher Marlowe actually penned the masterpieces attributed to Shakespeare. Re- searchers have used computers to find similarities in the writings of these two authors. This exercise examines three methods for analyzing texts with a computer. a) Write a program that reads several lines of text and prints a table indicating the number of occurrences of each letter of the alphabet in the text. For example, the phrase To be, or not to be: that is the question: contains one "a," two “b's," no “c's," and so on. b) Write a program that reads several lines of text and prints a table indicating the number of one-letter words, two-letter words, three-letter words, and so on, appearing in the text. For example, the phrase Whether 'tis nobler in the mind to suffer contains

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
8.31
(Text Analysis) The availability of computers with string-manipulation capabilities has re-
sulted in some rather interesting approaches to analyzing the writings of great authors. Much atten-
tion has been focused on whether William Shakespeare ever lived. Some scholars find substantial
evidence that Christopher Marlowe actually penned the masterpieces attributed to Shakespeare. Re-
searchers have used computers to find similarities in the writings of these two authors. This exercise
examines three methods for analyzing texts with a computer.
a) Write a program that reads several lines of text and prints a table indicating the number
of occurrences of each letter of the alphabet in the text. For example, the phrase
To be, or not to be: that is the question:
contains one "a," two “b's," no “c's," and so on.
b) Write a program that reads several lines of text and prints a table indicating the number
of one-letter words, two-letter words, three-letter words, and so on, appearing in the
text. For example, the phrase
Whether 'tis nobler in the mind to suffer
contains
Word length
Оccurrences
1
2
2
3
1
4
2 (including 'tis)
5
6.
2
7
1
Text book : "C How to program 8th Edition"
Amendments
1) Instead of reading several lines of text, just hard-code the following text in the program
a. myString= "The quick Brown ? Fox ? jumps over the Lazy Dog and the !##! LAZY DOG is
still sleeping".
b. The program should work with any value assigned to myString.
С.
Use a very small set of text (like “Ab#C#d" ) to test/debug your program first.
2) The program should make use of a function that converts the text to lower case (need to create
your own conversion logic) and then perform the analysis in the main function. Ignore any
numbers, symbols or special characters, etc in the text if any.
Note : It's easier to create a new string for the result instead of modifying the original
string.
3) Instead of the three methods outlined in the original question, complete only part a and part b.
Assume maximum length is 10 for part b.
4) Turn in one program that contains part a and b.
Output
Transcribed Image Text:8.31 (Text Analysis) The availability of computers with string-manipulation capabilities has re- sulted in some rather interesting approaches to analyzing the writings of great authors. Much atten- tion has been focused on whether William Shakespeare ever lived. Some scholars find substantial evidence that Christopher Marlowe actually penned the masterpieces attributed to Shakespeare. Re- searchers have used computers to find similarities in the writings of these two authors. This exercise examines three methods for analyzing texts with a computer. a) Write a program that reads several lines of text and prints a table indicating the number of occurrences of each letter of the alphabet in the text. For example, the phrase To be, or not to be: that is the question: contains one "a," two “b's," no “c's," and so on. b) Write a program that reads several lines of text and prints a table indicating the number of one-letter words, two-letter words, three-letter words, and so on, appearing in the text. For example, the phrase Whether 'tis nobler in the mind to suffer contains Word length Оccurrences 1 2 2 3 1 4 2 (including 'tis) 5 6. 2 7 1 Text book : "C How to program 8th Edition" Amendments 1) Instead of reading several lines of text, just hard-code the following text in the program a. myString= "The quick Brown ? Fox ? jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping". b. The program should work with any value assigned to myString. С. Use a very small set of text (like “Ab#C#d" ) to test/debug your program first. 2) The program should make use of a function that converts the text to lower case (need to create your own conversion logic) and then perform the analysis in the main function. Ignore any numbers, symbols or special characters, etc in the text if any. Note : It's easier to create a new string for the result instead of modifying the original string. 3) Instead of the three methods outlined in the original question, complete only part a and part b. Assume maximum length is 10 for part b. 4) Turn in one program that contains part a and b. Output
Original text:
The quick Brown ? Fox ? jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping
Modified text:
the quick brown fox jumps over the lazy dog and the lazy dog is still sleeping
Letter Count
a
2
b
1
Word length
Occurrences
1
Required:
Use two 2 dimensional arrays to emulate the tables that will capture the result of the analysis. One for
part a and another for part b.
Use loops to initialize the array values.
Indent your code/ provide comments when implementing somethings that require some logic.
Do not use 26 if statements to check for each letter. Use range of the alphabet (like between the
starting and ending ASCII value of the letters).
Create a function that will
a) Accept two strings: target and source
b) Copy from source to target; consume only A-Z, a-z and space, converting all upper case
letters to lower case and ignoring everything else.
Transcribed Image Text:Original text: The quick Brown ? Fox ? jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping Modified text: the quick brown fox jumps over the lazy dog and the lazy dog is still sleeping Letter Count a 2 b 1 Word length Occurrences 1 Required: Use two 2 dimensional arrays to emulate the tables that will capture the result of the analysis. One for part a and another for part b. Use loops to initialize the array values. Indent your code/ provide comments when implementing somethings that require some logic. Do not use 26 if statements to check for each letter. Use range of the alphabet (like between the starting and ending ASCII value of the letters). Create a function that will a) Accept two strings: target and source b) Copy from source to target; consume only A-Z, a-z and space, converting all upper case letters to lower case and ignoring everything else.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

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