NLTK将节添加到语料库

2024-10-03 02:33:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我将使用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-摘要.txt,纸张-1-简介.txt,并使用明文微粒读取器。这样做效果不好-每个真实文档都有多个nltk文档。你知道吗

如有任何建议,我们将不胜感激。你知道吗


Tags: 文档文本txtabstractreadheresectionroot