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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Concepts Of Programming Languages
Authors: Robert Sebesta
11th Edition
013394302X, 978-0133943023
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App