Python client for Grobid Quantities
Python client to query the Grobid Quantities service API For more information about Grobid Quantities, please check the Grobid Quantities Documentation.
Installation
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: quantities.py [-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
Initialisation:
from grobid_quantities.quantities import Quantities client = QuantitiesAPI(base_url=http(s)://server_url:port/base/url)
Process raw text:
client.process_text(
"I lost two minutes"
)
Process PDF document:
client.process_pdf(pdfFile)
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:
(
200,
{
"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
}
}
]
}
)
Metadata
Release files for grobid-quantities-client 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| grobid-quantities-client-0.4.0.tar.gz | 11.1 kB | Without provenance | Details for grobid-quantities-client-0.4.0.tar.gz |
Release files / grobid-quantities-client-0.4.0.tar.gz
| Download URL | grobid-quantities-client-0.4.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c4d200bf6c01a10f2c6174e25ae769eef62f0da31275cce69b30a0aeecbce92
|
|
BLAKE2b-256 checksum How to use checksums |
cb65592c489e27d0c19ba759577418fe2b97ddb0197fd0811f7d468a311a10ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.15
|
Security for grobid-quantities-client 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.