Question: Split the text file into list of messages
A file that contains English sentences. Sentences(of course) separated by the period “.” character.
Write a function that takes this file as an input and returns multiple SMS(140 char) messages. Also, append (1/n) at the end of each message.
Condition 1: please do NOT have a message with split words(split sentences are ok)
Condition 2: Please do this with 1 pass of the file (no char should be read twice from the file)
Condition 3: File is small enough to load into memory.
Example 1:
Input text file content:
Articles is a piece of writing and is produced either in a printed or electronic form, in newspaper, magazine, journal or website. It has a large readership in mind. It is based on surveys, research, facts and analysis etc. Articles may be short or slightly long may be upto 1500 words. It is written with a definite objective and informs the readers about some concept.
Output:
Articles is a piece of writing and is produced either in a printed or electronic form, in newspaper, magazine, journal or website. It(1/3) has a large readership in mind. It is based on surveys, research, facts and analysis etc. Articles may be short or slightly long may be(2/3) up to 1500 words. It is written with a definite objective and informs the readers about some concept. (3/3)
Example 2:
Input text file content:
Essay is formal and comprehensive piece of literature that describes a particular issue or topic analysed and discussed. It refers to a short piece of writing on a particular subject. Mainly students in their academics are asked to write essays on some topics as a response to a question or proposition. It does not have a specific readership in mind. Through essays, writer or narrator expresses his or her personal views or opinion on a particular topic or a question, and it is based on an educational and analytical tone. Let’s take an example and understand what is essay clearly suppose a school student has its exam and in question paper, he has been asked to write something explaining about Floods in India which is an example of essay.
Output:
Essay is formal and comprehensive piece of literature which describes to a particular issue or topic analysed and discussed. It refers(1/6) to a short piece of writing on a particular subject. Mainly students in their academics are asked to write essays on some topics as a(2/6) response to a question or proposition. It does not have a specific readership in mind. Through essays writer or narrator expresses his(3/6) or her personal views or opinion on a particular topic or a question and it is based on educational and analytical tone. Let’s take an(4/6) example and understand what is essay clearly suppose a school student has its exam and in question paper it has been asked to write(5/6) something explaining about Floods in India which is an example of essay. (6/6)