How convert paragraphs into sentences | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How convert paragraphs into sentences

19th May 2019, 12:24 PM
Simran Jassi
Simran Jassi - avatar
6 Answers
+ 19
Consider this is the your paragraph : "Hello World. This is a Paragraph. This code is written in Python. Python is an interpreted language.". This is stored in a varable named text. You can use the split() method which will return a list of strings (or you can sentences) after breaking the string by a full stop which is the specified separator. You can refer the below code snippet : > text = 'Hello World. This is a Paragraph. This code is written in Python. Python is an interpreted language.' > list = [] > list = text.split('.') > print(list) You will get each individual sentence as a single element of the string.
19th May 2019, 2:27 PM
Nova
Nova - avatar
+ 3
You can use the split method on each period.
19th May 2019, 1:40 PM
Steven M
Steven M - avatar
+ 3
You can split based off of punctuation followed by double space. split('. ')
19th May 2019, 3:02 PM
Steven M
Steven M - avatar
+ 2
Goog luck Simran :)
19th May 2019, 3:07 PM
Steven M
Steven M - avatar
+ 1
Thanks But if paragraph is "hello mr. Keval how are you?"
19th May 2019, 2:31 PM
Simran Jassi
Simran Jassi - avatar
0
Put problem is mr. Prof. Words
19th May 2019, 1:41 PM
Simran Jassi
Simran Jassi - avatar