LISTSERV mailing list manager LISTSERV 16.5

Help for CODE4LIB Archives


CODE4LIB Archives

CODE4LIB Archives


CODE4LIB@LISTS.CLIR.ORG


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CODE4LIB Home

CODE4LIB Home

CODE4LIB  February 2019

CODE4LIB February 2019

Subject:

Re: hathitrust api

From:

Eric Lease Morgan <[log in to unmask]>

Reply-To:

Code for Libraries <[log in to unmask]>

Date:

Mon, 11 Feb 2019 15:26:12 -0500

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (86 lines)

On Feb 10, 2019, at 9:38 PM, Conal Tuohy <[log in to unmask]> wrote:

> You may have tried this already, but it seems that Hathi also offer PDF-
> and EBM-formatted data at the volume level. Do those formats include the
> OCR text? I have seen this done in PDF before (and I've done it myself):
> the files contain bitmap page images but the OCR text is also there, in a
> layer beneath the images.

Alas, programmatically downloading a PDF file with embedded OCR is not an option. The documentation [1] says a format called ebm is possible, and pdf or epub are for the future. After programmatically authenticating and submitting the following RESTful URLs, I get either error 400 ("invalid or missing format parameter value format=pdf") or 403 ("insufficient privilege")

  https://babel.hathitrust.org/cgi/htd/volume/uva.x000274833?format=pdf
  https://babel.hathitrust.org/cgi/htd/volume/uva.x000274833?format=ebm

Apparently, PDF is not supported (yet), and ebm is restricted to the Espressnet Project.


On Feb 11, 2019, at 9:52 AM, Angelina Zaytsev <[log in to unmask]> wrote:

> As a University of Notre Dame librarian, you should be able to log into HathiTrust by clicking the login button, selecting University of Notre Dame from the dropdown menu, and then logging in with your Notre Dame username and password. Once you do so, you'll be able to download the full pdf through the user interface (the full pdf download option is not available to non-logged in, non-member users) at https://hdl.handle.net/2027/uva.x000274833 . That option should be easier for retrieving the full pdf than using the Data API. 
> 
> If you just need the plain text OCR for a few books, you may want to download the pdfs from the user interface and use the "Export to" feature in Adobe to save the OCR that's embedded within the pdf as a txt file. 
> 
> If you need the OCR for a larger number of volumes, then you may want to consider requesting a dataset (see https://www.hathitrust.org/datasets ) or using the HathiTrust Research Center services (see https://analytics.hathitrust.org/ ). The datasets are more appropriate for thousands of volumes.

The process outlined above is feasible for the analysis of a few documents, no more than a dozen and probably less. The process -- while functional -- is not feasible for the person who wants to study the complete works for X, all the things written in English during a particular decade, or any number of other subsets of the 'Trust. Nor is the English major, historian, or even typical librarian going to VPN into a virtual machine, work from the command line, invoke the secure environment, and then write Python scripts to do their good work. The learning curve is too high.


On Feb 11, 2019, at 1:04 PM, Kyle Banerjee <[log in to unmask]> wrote:

> Haven't used the Hathi API before. Is multithreading possible or do
> tech/policy constraints make that approach a nonstarter or otherwise not
> worth pursuing?
> 
> Peeking the documentation, I noticed a htd:numpages element. If that is
> usable, it would prevent the need to rely on errors to detect the document
> end.

Multithreading? Yes, I've given that some thought. Now-a-days our computers have multiple cores. My computer at work is nothing very special, and it has 8 cores. My computer at home as 4. When I bought them I had no idea they had more than one.  8-)  In the recent past I learned more about parallel processing, and yes, multithreading is an option; use each core to get a page, and when all pages are gotten, assemble the whole. Both cool & "kewl".

htd:numpages? I'd like to know more about this. I didn't see that element in the documentation, nor in the various metadata files I've downloaded.


The HathiTrust is such a rich resource, but it is not easy to use at the medium scale. Reading & analyzing a few documents is easy. It is entirely possible to generate PDF files, download them, print them (gasp!), extract their underlying plain (OCR) text, and use both traditional as well as non-traditional methods (text mining) to read their content. At the other end of the scale I might be able to count & tabulate all of the adjectives used in the 19th Century or see when the word "ice cream" first appeared in the lexicon.

On the other hand, I believe more realistic use cases exist: analyzing the complete works of Author X, comparing & contrasting Author X with Author Y, learning how the expression or perception of gender may have changed over time, determining whether or not there are themes associated with specific places, etc.

I imagine the following workflow:

  1. create HathiTrust collection
  2. download collection as CSV file
  3. use something like Excel, a database program, or OpenRefine
     to create subsets of the collection
  4. programmatically download items' content & metadata
  5. update CSV file with downloaded & gleaned information
  6. do analysis against the result
  7. share results & analysis

Creating the collection (#1) is easy. Search the 'Trust, mark items of interest, repeat until done (or tired). 

Downloading (#2) is trivial. Mash the button.

Creating subsets (#3) is easier than one might expect. Yes, there are MANY duplicates in a collection, but OpenRefine is GREAT at normalizing ("clustering") data, and once it is normalized, duplicates can be removed confidently. In the end, a "refined" set of HathiTrust identifiers can be output. 

Given a set of identifiers, it ought to be easy to programmatically download (#4) the many flavors of 'Trust items: PDF, OCRed plain text, bibliographic metadata, and the cool JSON files with embedded part-of-speech analysis. This is the part which is giving me the most difficulty. Slow; download speeds of 1000 bytes/minute. [2] Access control & authentication, which I sincerely understand & appreciate. Multiple data structures. For example, the bibliographic metadata is presented as a stream of JSON, and embedded in it is an escaped XML file, which, in turn, is the manifestation of a MARC bibliographic record. Yikes!

After the many flavors are downloaded, more interesting information can be gleaned: sentences, parts-of-speech, named entities, readability scores, sentiment measures, log-likelihood ratios, "topics" & other types of clusters, definitive characteristics of similarly classified documents, etc. In the end the researcher would have created a rich & thorough dataset (#5). This is the sort of work I do on a day-to-day basis. 

Through traditional reading as well as through statistics, the researcher can then do #6 against the printed PDF files and dataset. This is where I provide assistance, but I don't do the "real" work; this is primarily the work of discipline-specific researchers. 

Again, the HathiTrust is really cool, but getting content out of it is not easy. But maybe I'm trying to use it when my use case is secondary to the 'Trust's primary purpose. After all, isn't the 'Trust primarily about preservation? "An elephant never forgets."


[1] documentation - https://www.hathitrust.org/documents/hathitrust-data-api-v2_20150526.pdf
[2] At a rate of 1000 bytes/minute, it would take you approximately 60 seconds to download this email message.

-- 
Eric Lease Morgan
Digital Initiatives Librarian, Navari Family Center for Digital Scholarship
Hesburgh Libraries

University of Notre Dame
250E Hesburgh Library
Notre Dame, IN 46556
o: 574-631-8604
e: [log in to unmask]
w: cds.library.nd.edu

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 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
June 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
June 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
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
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
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003

ATOM RSS1 RSS2



LISTS.CLIR.ORG

CataList Email List Search Powered by the LISTSERV Email List Manager
https://lists.clir.org/cgi-bin/wa?A2=ind1902&L=CODE4LIB&D=0&P=43739
lists.clir.org
crawl=CC-MAIN-2022-33
64655
application/http; msgtype=response
sha1:I7CPH2IMICDETW4KWMFVB43DTIDF2SH4
<urn:uuid:2c26b4d8-4d24-4892-a247-0434d26aa118>
2022-08-17T12:59:18Z
66.175.211.245
text/html
sha1:T3HDBKRUMUPYBX2ONTDHYFTBTN52E5XY
<urn:uuid:59256f01-1f10-4488-9ad2-112e23387315>
https://lists.clir.org/cgi-bin/wa?A2=ind1902&L=CODE4LIB&D=0&P=43739
response
<urn:uuid:5e751066-a26f-48fb-a43a-e5915229c5bc>
isPartOf: CC-MAIN-2022-33
publisher: Common Crawl
description: Wide crawl of the web for August 2022
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-170
software: Apache Nutch 1.18 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.4-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/