Skip to main content

A minimal client for grobid-quantities service.

Project description

Python client to query the Grobid Quantities service API For more information about Grobid Quantities, please check the Grobid Quantities Documentation.


The client can be installed using pip:

pip install grobid-quantities-client

Command Line Interface (CLI)

The CLI follows the following parameters:

python -m grobid_quantities.quantities --help
usage: [-h] --input INPUT [--output OUTPUT] [--base-url BASE_URL] [--config CONFIG] [--n N] [--force] [--verbose]

Client for the Grobid-quantities service

optional arguments:
  -h, --help           show this help message and exit
  --input INPUT        path to the directory containing PDF files or .txt (for processCitationList only, one reference per line) to process
  --output OUTPUT      path to the directory where to put the results (optional)
  --base-url BASE_URL  Base url of the service (without the suffix `/service/`)
  --n N                concurrency for service usage
  --force              force re-processing pdf input files when tei output files already exist

API Usage


from grobid_quantities.quantities import Quantities
client = QuantitiesAPI(base_url=http(s)://server_url:port/base/url)

Process raw text:

    "I lost two minutes"

Process PDF document:


Parse the measurements:

client.parse_measures("from": "10", "to": "20", "unit": "km")

The response is a tuple where the first element is the status code and and the second element the response body as a dictionary. Here an example:

       "runtime": 123,
       "measurements": [
           "type": "value",
           "quantity": {
             "type": "time",
             "rawValue": "two",
             "rawUnit": {
               "name": "minutes",
               "type": "time",
               "system": "non SI",
               "offsetStart": 11,
               "offsetEnd": 18
             "parsedValue": {
               "numeric": 2,
               "structure": {
                 "type": "ALPHABETIC",
                 "formatted": "two"
               "parsed": "two"
             "normalizedQuantity": 120,
             "normalizedUnit": {
               "name": "s",
               "type": "time",
               "system": "SI base"
             "offsetStart": 7,
             "offsetEnd": 11

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grobid-quantities-client-0.4.0.tar.gz (11.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page