Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a program in C that reads texts from the user and breaks them down into words, sentences, and paragraphs. A word consists of 1

Develop a program in C that reads texts from the user and breaks them down into words, sentences, and paragraphs. A word consists of 1 or more consecutive letters

(lowercase and uppercase)

A sentence consists of 1 or more words (separated by spaces)

or other characters) ending with . or ! or ? or ;

A paragraph consists of 1 or more sentences that

end with a line shift character.

The program will continuously request commands from the user until it accepts the qt command that terminates the program.

The commands it can accept are:

"ap:" After this command the program should read one

paragraph (maximum length of 10000 characters) to parse it in

sentences and words and store it in appropriate structures in memory.

fw: After this command the program should read one

string (max 10000 characters long) and display the words

containing the specific string inside them. Note: The

program should display only once each word (even if

this is repeated in the text). See the examples in the eagle

"fs:" After this command the program should read one

string (up to 10000 characters long) and display them

sentences containing the specific string inside them.

Note: In displaying suggestions the program should

displays the words in the correct order (separated by exactly one space) and

after a line shift character. The other characters probably

given by the user will not be displayed. See the examples in the eagle

fp: After this command the program should read one

string (up to 10000 characters long) and display them

paragraphs containing the specified string inside them.

Note: In displaying paragraphs the program should

shows all sentences in this paragraph according to

previous. See the examples in the eagle

"owf" The program should display all words in the text (each

word will appear only once) sorted in descending order

the number of impressions of each word in the text. If 2 words

have the same frequency of occurrence to be sorted by ascending order

lexicographic series (first chapters after lowercase). Every word should

appear along with its display number in [] (eg the [3],

since the word had 3 times the text)

"owl" The program should display all words in the text (each

word will appear only once) sorted by ascending order

the length of each word. If 2 words are the same length as

are sorted in ascending order (first chapters after

lowercase). Each word should appear along with its length in [] (e.g.

Graham [6], as the word is 6 letters long)

qt The program should shut down.

Note: The program will run in a restricted environment

stack resources so you should use as much as possible

more dynamic memory management and avoid static matrices

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books