You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Compare Python PDF extraction libraries with sample files #30
Write up mini-paper comparing performance of various text-extractors on a document with available plaintext (possibly a particular edition of the bible).
Find popular samples with clean and accurate plain text.
For each sample, find versions of varying quality.
One version should be a PDF I generate from the plain text.
One version should be a rich PDF where text is queryable.
One version should require OCR.
Trim extra info like page number and Project Gutenberg header, if possible.
An approach could be to locate the first and last sentence of the text, consider only between these.
Or, just leave it be? All extractors will pick up this noise and it's expected in typical use cases.
Determine which PDF extractor libraries to test.
Definitely PDFMiner since I've already reverse-engineered it programatically.
Determine the measures of extraction accuracy.
I've used various measures of string difference in the FuzzyWuzzy library with some success.
Measure speed.
Many of these libraries do layout analysis--is this helpful or not? Surely has an effect on speed.
Run the conversions and calculate accuracy.
Create a testing suite that determines setting regimes with uniformly better accuracy and use those settings as the benchmark for a particular library.
Hi Mark -- I experimented a bit with PyPDF and PDFMiner for syllabus
extraction. PyPDF seemed to be smoother to work with. I tried extracting
syllabi into plain text and html. The extractors captured most of the text
correctly but, in cases where the formatting was complicated or had lots of
tables, it jumbled the order.
Write up mini-paper comparing performance of various text-extractors on a
document with available plaintext (possibly a particular edition of the
bible).
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/30
.
I'm going to move ahead with V1 given these resources. I'll make the platform flexible enough to support the addition of other PDF extractors in case we come across any serious contenders that I've missed.
Graham and Dennis: let me know if you have any suggestions, especially with the selection of source texts. I went with P&P because it's in the public domain, was written in English, and has a range of released PDFs.
I had read about slate while looking into PDFMiner and I thought it sounded
very good and comparatively user-friendly, but I wasn't able to get it
working due to a dependency issue I was never able to resolve. If you can
it working, that's great as it sounds like a good library.
I'm going to move ahead with V1 given these resources. I'll make the
platform flexible enough to support the addition of other PDF extractors in
case we come across any serious contenders that I've missed.
Graham and Dennis: let me know if you have any suggestions, especially
with the selection of source texts. I went with P&P because it's in the
public domain, was written in English, and has a range of released PDFs.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-44140539
.
Jumping in after not contributing very much... I'm familiar with some of the people who are maintaining Apache Tika out at NASA JPL. It is a project that has a strong core team of developers, and has overlapping goals with textract. The advantage to Tika (and textract) is that you don't need separate logic for each document format, and you also get standard metadata for each document.
Tika wraps around pdfbox for pdf documents, which performed a 6 second extraction in the benchmarking stats file. I bet the slowness was caused by the bootup time of the JVM, though. If you separate the JVM initialization code with the conversion, I imagine it's more in the range of the pure-python extractors. This is how I've used Tika in python in the past: www.hackzine.org/using-apache-tika-from-python-with-jnius.html
Activity
grahamsack commentedon May 22, 2014
Hi Mark -- I experimented a bit with PyPDF and PDFMiner for syllabus
extraction. PyPDF seemed to be smoother to work with. I tried extracting
syllabi into plain text and html. The extractors captured most of the text
correctly but, in cases where the formatting was complicated or had lots of
tables, it jumbled the order.
Best,
Graham
On Thu, May 22, 2014 at 12:41 PM, Mark Gorenstein
notifications@github.comwrote:
denten commentedon May 22, 2014
We are planning to do a more formal comparison. Stay tuned.
grahamsack commentedon May 22, 2014
If you want to leverage it, I put my code for the extractor in the opensyllabus/Classifiers folder.
mgorenstein commentedon May 23, 2014
Thanks, Graham.
mgorenstein commentedon May 24, 2014
Libraries
os.system()to execute through Python.Source Texts
mgorenstein commentedon May 25, 2014
I'm going to move ahead with V1 given these resources. I'll make the platform flexible enough to support the addition of other PDF extractors in case we come across any serious contenders that I've missed.
Graham and Dennis: let me know if you have any suggestions, especially with the selection of source texts. I went with P&P because it's in the public domain, was written in English, and has a range of released PDFs.
initial commit for #30
pdfminer compatibility for #30
grahamsack commentedon May 26, 2014
I had read about slate while looking into PDFMiner and I thought it sounded
very good and comparatively user-friendly, but I wasn't able to get it
working due to a dependency issue I was never able to resolve. If you can
it working, that's great as it sounds like a good library.
On Sun, May 25, 2014 at 1:29 PM, Mark Gorenstein
notifications@github.comwrote:
PyPDF2 support for #30
PDFBox integration for #30
xpdf integration for #30
textstream integration for #30
Timing stats are all set for #30
mrenoch commentedon Aug 4, 2014
This could be worth checking out, to unify and maybe simplify text extraction:
http://datascopeanalytics.com/what-we-think/2014/07/27/extract-text-from-any-document-no-muss-no-fuss
https://github.com/deanmalmgren/textract
samzhang111 commentedon Dec 21, 2014
Jumping in after not contributing very much... I'm familiar with some of the people who are maintaining Apache Tika out at NASA JPL. It is a project that has a strong core team of developers, and has overlapping goals with textract. The advantage to Tika (and textract) is that you don't need separate logic for each document format, and you also get standard metadata for each document.
Tika wraps around pdfbox for pdf documents, which performed a 6 second extraction in the benchmarking stats file. I bet the slowness was caused by the bootup time of the JVM, though. If you separate the JVM initialization code with the conversion, I imagine it's more in the range of the pure-python extractors. This is how I've used Tika in python in the past: www.hackzine.org/using-apache-tika-from-python-with-jnius.html
Cheers,
Sam
chrismattmann commentedon Jan 25, 2015
Thanks @samzhang111 yep, happy to provide any info here on Tika if it helps
chrismattmann commentedon May 20, 2015
Coming back here, just FYI we have a fully supported Tika port to Python using the JAX-RS REST server. FYI: https://github.com/chrismattmann/tika-python