PoeTree
收藏资源简介:
PoeTree是一个标准化的诗歌语料库集合,包含超过330,000首诗歌,涵盖十种语言(捷克语、英语、法语、德语、匈牙利语、意大利语、葡萄牙语、俄语、斯洛文尼亚语和西班牙语)。每个语料库都经过去重处理,增加了通用依存关系,提供了额外的元数据,并转换为统一的JSON结构。
PoeTree is a standardized collection of poetry corpora, encompassing over 330,000 poems across ten languages (Czech, English, French, German, Hungarian, Italian, Portuguese, Russian, Slovenian, and Spanish). Each corpus has been deduplicated, enhanced with universal dependencies, provided with additional metadata, and converted into a unified JSON structure.
数据集概述
Poetree是一个包含超过330,000首诗歌的标准化集合,涵盖十种语言(捷克语、英语、法语、德语、匈牙利语、意大利语、葡萄牙语、俄语、斯洛文尼亚语和西班牙语)。每个语料库都经过去重处理,并丰富了通用依存关系,提供了额外的元数据,并转换为统一的JSON结构。
数据集内容
- Poetree:代表整个Poetree集合。
- Corpus:代表单个语料库。
- Author:代表单个作者。
- Source:代表单个书籍。
- Poem:代表单个诗歌。
数据集操作
- 安装:通过pip安装poetree库。
- 使用:通过导入poetree库,可以使用其提供的五个类进行数据操作。
- 获取数据:
- 通过
get_corpora(),get_authors(),get_sources(),get_poems()方法获取相应数据。 - 通过
get_body()方法获取诗歌的详细内容。 - 通过
get_all()方法同时获取诗歌的元数据和详细内容。
- 通过
- 元数据访问:通过
metadata()方法访问元数据,支持多种输出格式。
示例代码
python corpus = poetree.Corpus(cs) print(number of authors:, corpus.n_authors) print(number of poems:, corpus.n_poems)
corpus = poetree.Corpus(en) for author in corpus.get_authors(born_after=1750, born_before=1760): print(f{author.name} ({author.born}))
poem = poetree.Poem(id_=1, lang=cs) body = poem.get_body() print(body[0])
poem = poetree.Poem(id_=1, lang=cs) metadata_and_body = poem.get_all()




