Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Programming Languages

Authors: Robert Sebesta

11th Edition

013394302X, 978-0133943023

More Books

Students also viewed these Programming questions

Question

Develop a preliminary focus for your research.

Answered: 1 week ago

Question

What are the two common problems with pointers?

Answered: 1 week ago