NLTK将语句添加到语料库中

时间:2013-06-10 22:00:48

标签: python nltk

我将使用nltk处理科学论文。

首先,我想将论文的原始文本存储为文本文件。 文本文件将包含几个部分,如下所示:

纸的1.txt:

Abstract
[abstract here] 

Introduction
[introduction here]

Body
[body here]

在代码中,我想做这样的事情:

abstracts = nltk.SectionCorpusReader(root=..., section='abstract') # read abstracts only
full = nltk.SectionCorpusReader(root=..., section='full')          # read whole documents

我无法确定使用哪个语料库属性来表示这些部分。我试图将论文分成多个文件:paper-1-abstract.txt,paper-1-intro.txt等,并使用PlaintextCorpusReader。这不能很好 - 每个真实文档可以获得多个nltk文档。

任何建议都将受到赞赏。

0 个答案:

没有答案