npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cboulanger/grobid-client

v0.1.0

Published

Basic client for the GROBID service

Downloads

2

Readme

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:

| n | runtime (s)| s/PDF | PDF/s | |----|------------|-------|-------| | 1 | 230.9 | 1.69 | 0.59 | | 2 | 121.6 | 0.89 | 1.12 | | 3 | 87.9 | 0.64 | 1.55 | | 5 | 66.2 | 0.48 | 2.05 | | 8 | 57.7 | 0.42 | 2.35 | | 10 | 56.5 | 0.41 | 2.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 ([email protected])