【发布时间】:2019-05-24 09:52:38
【问题描述】:
我想用python 和pandas 来做这件事。
假设我有以下内容:
file_id text
1 I am the first document. I am a nice document.
2 I am the second document. I am an even nicer document.
我终于想拥有以下:
file_id text
1 I am the first document
1 I am a nice document
2 I am the second document
2 I am an even nicer document
所以我希望在每个句号处拆分每个文件的文本,并为这些文本的每个标记创建新行。
最有效的方法是什么?
【问题讨论】:
-
你可以使用
nltk.tokenize.sent_tokenize('text')来拆分句子。