How to split text into paragraphs using NLTK nltk.tokenize.texttiling?

前端 未结 2 1406
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-15 11:05

I found this Split Text into paragraphs NLTK - usage of nltk.tokenize.texttiling? explaining how to feed a text into texttiling, however I am unable to actually return a tex

2条回答
  •  渐次进展
    2021-01-15 11:51

    What about using splitlines? Or do you have to use the nltk package?

    email = """    From: X
        To: Y                             (LOGISTICS)
        Date: 10/03/2017
    
        Hello team,                       (INTRO)
    
        Some text here representing
        the body                          (BODY)
        of the text.
    
        Regards,                          (OUTRO)
        X
    
        *****DISCLAIMER*****              (POST EMAIL DISCLAIMER)
        THIS EMAIL IS CONFIDENTIAL
        IF YOU ARE NOT THE INTENDED RECIPIENT PLEASE DELETE THIS EMAIL"""
    
    y = [s.strip() for s in email.splitlines()]
    
    print(y)
    

提交回复
热议问题