Question: write function sentence_segmentation(document) that takes an input parameter document (type string) and returns a list of sentences from the given document.If no sentences could be

write function sentence_segmentation(document) that takes an input parameter document (type string) and returns a list of sentences from the given document.If no sentences could be segmented (think about the cases), then it simply returns an empty list.

NB: You are guaranteed that a document will not begin with the full stop character.

For example:

Test Result
document = "sent1. sent2. sent3. sent4. sent5." sentences = sentence_segmentation(document) print(sentences) ['sent1.', 'sent2.', 'sent3.', 'sent4.', 'sent5.']
document = "sent 1. sent 2... sent 3.... sent 4. sent 5.." sentences = sentence_segmentation(document) print(sentences) ['sent 1.', 'sent 2...', 'sent 3....', 'sent 4.', 'sent 5..']
document = "sent1.sent2.sent3.sent4.sent5." sentences = sentence_segmentation(document) print(sentences) ['sent1.sent2.sent3.sent4.sent5.']

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!