赞
踩
这里主要是使用了两个包:pyltp 和 nltk
安装过程省略,使用方式如下:
- import nltk # 英文分句
- from pyltp import SentenceSplitter # 中文分句
-
- s = "Since I was very small, I was very shy in the public place, so I always avoided giving performance in front of so many people. Though I tried hard to get over it in school, I still felt uneasy in the public place. When I came to the job market, I realized that I must get over my fear, or I would lose my stage.
- print "\n".join(nltk.sent_tokenize(s))
- # Since I was very small, I was very shy in the public place, so I always avoided giving performance in front of so many people.
- # Though I tried hard to get over it in school, I still felt uneasy in the public place.
- # When I came to the job market, I realized that I must get over my fear, or I would lose my stage.
- x = "在我很小的时候,在公共场合我会感到非常的害羞,所以我总是避免在人多的情况下表演。虽然我在学校努力想要克服这个问题,但在公共场合我还是感到不自在。当我来到就业市场时,我意识到我必须克服我的恐惧了,否则我将失去自己的舞台。"
- sents = SentenceSplitter.split(x)
- print "\n".join(sents)
- # 在我很小的时候,在公共场合我会感到非常的害羞,所以我总是避免在人多的情况下表演。
- # 虽然我在学校努力想要克服这个问题,但在公共场合我还是感到不自在。
- # 当我来到就业市场时,我意识到我必须克服我的恐惧了,否则我将失去自己的舞台。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。