解析Grobid。tei.xml文件靓汤输出

2024-04-29 04:57:21 发布

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

我试着用靓汤从a中提取元素。tei.xml文件使用Grobid生成的文件。在

我可以使用以下方式获取标题:

titles = soup.findAll('title')

访问“低级”元素的正确语法是什么?作者/附属机构

这是tei.xml文件作为Grobid输出的文件:

^{pr2}$

谢谢。在


Tags: 文件元素标题机构title方式语法作者
1条回答
网友
1楼 · 发布于 2024-04-29 04:57:21

BeautifulSoup将节点小写,下面是一些示例:

title = soup.html.body.teiheader.filedesc.analytic.title.string

for author in soup.html.body.teiheader.filedesc.sourcedesc.find_all('author'):
    tag_or_none = author.persname.forename
    first_affiliation = author.affiliation

还有see the BeautifulSoup documentation它涵盖了所有内容。在

我正在研究一个类似的问题,并寻求合作。如果你想合作就告诉我sof@nconor.com在

相关问题 更多 >