Question: Consider the task of translating a plain-text book from Project Gutenberg (http:// gutenberg.org) to HTML. For example, here is the start of the first chapter
Consider the task of translating a plain-text book from Project Gutenberg (http://
gutenberg.org) to HTML. For example, here is the start of the first chapter of Tol stoy’s Anna Karenina:
Chapter 1 Happy families are all alike; every unhappy family is unhappy in its own way.
Everything was in confusion in the Oblonskys' house. The wife had discovered that the husband was carrying on an intrigue with a French girl, who had been a governess in their family, and she had announced to her husband that she could not go on living in the same house with him . . .
The equivalent HTML is:

The HTML conversion can be carried out in two steps. First, the plain text is assembled into segments, blocks of text of the same kind (heading, paragraph, and so on).
Then each segment is converted, by sur rounding it with the HTML tags and converting special characters.
Fetching the text from the Internet and breaking it into segments is a challenging task. Provide an inter face and a mock implementation. Combine it with a class that uses the mock implementation to finish the formatting task.

Chapter 1 Happy families are all alike; every unhappy family is unhappy in its own way. Everything was in confusion in the Oblonskys’ house. The wife had discovered that the husband was carrying on an intrigue with a French girl, who had been a governess in their family, and she had announced to her husband that she could not go on living in the same house with him...
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
To translate a plaintext book to HTML format we need to create a system that can 1 Fetch the plain text from the internet 2 Segment the text into headings paragraphs and other relevant sections 3 Wrap ... View full answer
Get step-by-step solutions from verified subject matter experts
