Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cboulanger/grobid-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cboulanger/grobid-client

Basic client for the GROBID service

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Simple node.js client for GROBID REST services

This node.js module can be used to process in an efficient concurrent manner a set of PDF in a given directory by the GROBID service. Results are written in a given output directory and include the resulting XML TEI representation of the PDF.

Build and run

You need first to install and start the grobid service, latest stable version, see the documentation. By default, it is assumed that the server will run on the address http://localhost:8070. You can change the server address by editing the config file config.json.

Install the present module:

npm install

Usage (GROBID server must be up and running):

node main -in PATH_TO_THE_PDFS_TO_PROCESS -out WHERE_TO_PUT_THE_RESULTS

Example:

node main -in ~/tmp/in -out ~/tmp/out

Only the files with extension .pdf present in the input directory (-in) will be processed, the other files will be ignored. Results will be written in the output directory (-out), reusing the file name with a different file extension (.tei.xml).

Other parameters

  • n: the number of concurrent call to GROBID, default is 10

  • the service to be called, default being processFulltextDocument (full processing of the document body), other possibilities are processHeaderDocument (only extracting and structuring the header) and processReferences (only extracting and structuring the bibliographical references).

Example:

node main -in ~/tmp/in -out ~/tmp/out -n 20 processHeaderDocument

This command will extract the header of the PDF files under ~/tmp/in with 20 concurrent calls to the GROBID server and write the TEI results under ~/tmp/out.

Benchmarking

Full text processing of 136 PDF (total 3443 pages, in average 25 pages per PDF) on Intel Core i7-4790K CPU 4.00GHz, 4 cores (8 threads), 16GB memory, n being the concurrency parameter:

nruntime (s)s/PDFPDF/s
1230.91.690.59
2121.60.891.12
387.90.641.55
566.20.482.05
857.70.422.35
1056.50.412.41

Runtime Plot

As complementary info, GROBID processing of header of the 136 PDF and with n=10 takes 5.37 s (8 times faster than the complete full text processing because only the two first pages of the PDF are considered), 25.33 PDF/s. In similar conditions, extraction and structuring of bibliographical references takes 27.1 s, 5.02 PDF/s.

A variant of this node.js client for the ISTEX resources (22 million PDF) scaled to around 11 PDF per second with 2 16-CPU servers, processing approx. 950K PDF per day.

Todo

Benchmarking with more files (e.g. million ISTEX PDF). Also implement existing GROBID services for text input (date, name, affiliation/address, raw bibliographical references, etc.). Better support for parameters (including elements where to put coordinates).

Requirements

  • async
  • request
  • form-data
  • mkdirp
  • sleep

License

Distributed under Apache 2.0 license.

Main author and contact: Patrice Lopez (patrice.lopez@science-miner.com)

Keywords

FAQs

Package last updated on 31 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc