1

Split Text with Punctuation

Unsolved
NLP

Difficulty: 3 | Problem written by mesakarghm
Problem reported in interviews at

Amazon
Facebook
Google

The domain of NLP includes a variety of text preprocessing steps that makes it easier for the computer to perform different operations. One of them is text splitting. Write a function parseText(text) which when given a string with multiple sentences split at the punctuations and returns a list with multiple sentences with a max length of 100 characters. 

The punctuation marks that can be seen in the input strings can be any of: 

[',',':',';','.','?','!']

For example: 

For the input text "Think of color, pitch, loudness, heaviness, and hotness. Each is the topic of a branch of physics."

The program should return a list : 

['Think of color,', 'pitch,', 'loudness,', 'heaviness,', 'and hotness.', 'Each is the topic of a branch of physics.'] 

Sample Input:
<class 'str'>
text: Think of color, pitch, loudness, heaviness, and hotness. Each is the topic of a branch of physics.

Expected Output:
<class 'list'>
['Think of color,', 'pitch,', 'loudness,', 'heaviness,', 'and hotness.', 'Each is the topic of a branch of physics.']

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Fuga quis eaque modi quisquam ratione consequuntur voluptate, sed aut accusamus officia unde non molestias quaerat optio, eos accusantium laborum quo harum ea facere deleniti voluptates doloremque in nemo, sapiente adipisci eum sed dicta culpa provident, et recusandae accusamus. Necessitatibus dolorem ad quos, natus consectetur illum qui quia, odio veritatis temporibus delectus hic recusandae cum quia inventore ullam laborum repudiandae, est doloribus alias eum aspernatur exercitationem temporibus.

Nostrum cupiditate dolor tempore molestias sequi corporis architecto, minus dolorum exercitationem dolor non nulla voluptates molestiae tenetur blanditiis, cupiditate possimus ex, dolorem minus ipsam magni tempore sint id autem aliquam labore, ex animi omnis cupiditate dignissimos quaerat maiores eos voluptate atque ipsam. Similique autem cupiditate incidunt aut soluta, ducimus saepe voluptatibus cum atque possimus eos earum, culpa voluptatem exercitationem.

Deserunt et tenetur ducimus quam cupiditate dolorum eligendi dolorem quasi aspernatur, sequi quidem molestias?

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)