如何解决Python在每个换行符之间添加句号
我有一个带文本的PDF,我使用PuMuPDF(fitz)提取每一页的数据。我想在句子开头添加句号。示例和代码如下所示:
示例:
MORE PAGE INFO
Name of the company and some info
More info here and here
The data above is correct. We are a registered firm,("ABC") for this company.
Technology etc,more sentences and a paragraph here. These sentences are much longer etc.
Here is another Pixmap example that creates Sierpinski’s Carpet – a fractal generalizing the Cantor Set to two dimensions. Given a square carpet.
所需的输出:
MORE PAGE INFO.
Name of the company and some info.
More info here and here.
The data above is correct. We are a registered firm,more sentences and a paragraph here. These sentences are much longer etc.
Here is another Pixmap example that creates Sierpinski’s Carpet – a fractal generalizing the Cantor Set to two dimensions. Given a square carpet.
当前代码:
doc =fitz.open(myfile)
page=doc[0]
for page in doc:
text = page.getText("text")
text =text.replace ("\n",'.')
print(text)
代码输出的确为短句添加了句号,但也为正确形成的句子添加了句号。我还有其他方法可以做到吗?
谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。