How to break a paragraph to sentences in python?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newbieinpython
    New Member
    • Sep 2012
    • 3

    How to break a paragraph to sentences in python?

    Hi, please help to hence me how to break a pargraph to print line by line if it ends with coma, it is a phras, if it ends with period , it is a sentence. Thank you soo much in advance.

    Andrea

    For example:

    text = "It's probably a great morning for a doughnut run in New York City, since you won't have to fight off the NYPD. Officers are already positioned at 21 different retailers to keep their eyes on the new iPhone 5. As part of "Operation ID," the cops are encouraging customers to engrave their new iAppendage with a unique NYC-prefaced serial number (at no cost), which will help identify the phone if it's lost or swiped."

    I want to print :
    Sentence 1:
    phrase 1 = "It's probably a great morning for a doughnut run in New York City.
    phrase 2 = since you won't have to fight off the NYPD

    Sentence 2:
    phrase 1 = Officers are already positioned at 21 different retailers to keep their eyes on the new iPhone 5...
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can use the split function.

    Comment

    Working...