Having blogged about the excitement of automatic reading and semantic enhancement of chemical theses I come to the startk reality of PDF.
“Turning PDF into XML is like turning a hamburger back into a cow” (anon).
So I searched for Openly exposed electronic chemical theses on the web. Yes, they are out there, but – in PDF. So here’s a typical tale of the sort of waste of time that I am colleagues have to go through.
I find a major academic institution (Foo) with a repository of theses. There are two versions – one that the world can read, and one private to Foo faculty. They seem to be the same, except that the Open one is “not printable”. I load it into my browser – it displays. I try to save as text. I try to select text and paste into a text editor (this usually works). It doesn’t. So presumably there is deliberately some sort of gremlin in the document which prevents Adobe tools saving the text. (I expect Adobe developed this specifically anayway).
PDF has already destroyed the structure of the document. But perhaps I can at least save the words. OSCAR3 is very good at reconstructing chemistry from words. I save the PDF locally (that seems to be technically allowed) and then I open it in a text editor. Gibberish – but I expected that.
So I download PDFBox from Sourceforge. A typical example of noble-spirited Open Source development – trying to make life better than the hamburger culture. It has an executable called ExtractText. I run it. “Null Pointer Exception” (This means the program has failed to trap an error – but I forgive them since by definition a hamburger is an error. I then notice another executable (SplitText). Expecting it to fail I run it. Surprisingly it works. It produces 200 little PDF files (one for each page in the thesis). Not the ideal thing to work with but serious progress.
Then I notice an option (-split). This says “only start splitting after n pages”). So I use -split 200. This creates one large PDF page (the same as the original document). This doesn’t seem like progress, but it is – the new file behaves perfectly with ExtractText. I can now convert the PDF to text without problems. And run it into OSCAR3. And more of this later.
Of course the resultant text is awful but at least it contains all the right words and in the right order. It cannot manage suffixes (for example H2SO4 – the chemical formula for sulfuric acid somes out as:
H
2
SO
4
).
That’s because PDF has no semantics. The ‘2’ and ‘4’ are just characters with X,Y coordinates – not associated with anything.
So the message is clear.
Do not author documents in PDF alone.
If you use another format (Word, HTML, TeX and perhaps even some time XML), preserve that version. If you are required to destroy the semantic into a hamburger, insist that the rich version is preserved. In your institutional repository.
Does this sorry story suggest that really we should be using XML for science, not PDF?
-
Recent Posts
-
Recent Comments
- pm286 on ContentMine at IFLA2017: The future of Libraries and Scholarly Communications
- Hiperterminal on ContentMine at IFLA2017: The future of Libraries and Scholarly Communications
- Next steps for Text & Data Mining | Unlocking Research on Text and Data Mining: Overview
- Publishers prioritize “self-plagiarism” detection over allowing new discoveries | Alex Holcombe's blog on Text and Data Mining: Overview
- Kytriya on Let’s get rid of CC-NC and CC-ND NOW! It really matters
-
Archives
- June 2018
- April 2018
- September 2017
- August 2017
- July 2017
- November 2016
- July 2016
- May 2016
- April 2016
- December 2015
- November 2015
- September 2015
- May 2015
- April 2015
- January 2015
- December 2014
- November 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- December 2006
- November 2006
- October 2006
- September 2006
-
Categories
- "virtual communities"
- ahm2007
- berlin5
- blueobelisk
- chemistry
- crystaleye
- cyberscience
- data
- etd2007
- fun
- general
- idcc3
- jisc-theorem
- mkm2007
- nmr
- open issues
- open notebook science
- oscar
- programming for scientists
- publishing
- puzzles
- repositories
- scifoo
- semanticWeb
- theses
- Uncategorized
- www2007
- XML
- xtech2007
-
Meta
Pingback: How to *not* package technical documentation « Scale or die