如何从pdf中提取特定标题下的文本? [英] How to extract text under specific headings from a pdf?

查看:459
本文介绍了如何从pdf中提取特定标题下的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用python从pdf中提取特定标题下的文本.

I want to extract text under specific headings from a pdf using python.

例如,我有一个标题为Introduction,Summary,Contents的pdf文件.我只需要提取摘要"标题下的文本即可.

For example, I have a pdf with headings Introduction,Summary,Contents. I need to extract only the text under the heading 'Summary'.

我该怎么做?

推荐答案

这种情况正是我目前在公司工作的情况.我们需要提取标题下的文本.我个人使用的是基于规则的系统,即在逐行阅读整个文档后,使用正则表达式来识别所有编号的标题.找到标题后,请输入要为其找到相应段落的标题的名称.此输入与现有的标题列表匹配,并使用通用句子编码器找到最接近的匹配项.之后,我只显示从该标题到下一个标题的所有内容.

This scenario is exactly what I am working on in my current company. We need to extract text lying under a heading. I'm personally using a rule based system i.e, using regex to identify all the numbered headings after reading the entire document line by line. Once I have the headings I enter the name of the heading for which I want to find the corresponding paragraph. This input is matched with the pre-existing list of headings and using universal sentence encoder I find the nearest match. After that I just display all the contents that is present from that heading upto the immediate next heading.

这篇关于如何从pdf中提取特定标题下的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆