Python client for Grobid Quantities
===================================
.. image:: http://img.shields.io/:license-apache-blue.svg
:target: http://www.apache.org/licenses/LICENSE-2.0.html
.. image:: https://travis-ci.org/hirmeos/entity-fishing-client-python.svg?branch=master
:target: https://travis-ci.org/hirmeos/entity-fishing-client-python
Python client to query the `Grobid Quantities service API`_
For more information about Grobid Quantities, please check the `Grobid Quantities Documentation`_.
.. _Grobid Quantities service API: http://github.com/kermitt2/grobid-quantities
.. _Grobid Quantities Documentation: http://nerd.readthedocs.io
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
}
}
]
}
)
Raw data
{
"_id": null,
"home_page": "https://github.com/lfoppiano/grobid-quantitites-python-client",
"name": "grobid-quantities-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "measurements,text mining,tdm,grobid",
"author": "Luca Foppiano",
"author_email": "FOPPIANO.Luca@nims.go.jp",
"download_url": "https://files.pythonhosted.org/packages/cb/65/592c489e27d0c19ba759577418fe2b97ddb0197fd0811f7d468a311a10ba/grobid-quantities-client-0.4.0.tar.gz",
"platform": null,
"description": "Python client for Grobid Quantities\n===================================\n\n.. image:: http://img.shields.io/:license-apache-blue.svg\n :target: http://www.apache.org/licenses/LICENSE-2.0.html\n\n.. image:: https://travis-ci.org/hirmeos/entity-fishing-client-python.svg?branch=master\n :target: https://travis-ci.org/hirmeos/entity-fishing-client-python\n\n\nPython client to query the `Grobid Quantities service API`_\nFor more information about Grobid Quantities, please check the `Grobid Quantities Documentation`_.\n\n.. _Grobid Quantities service API: http://github.com/kermitt2/grobid-quantities\n.. _Grobid Quantities Documentation: http://nerd.readthedocs.io\n\n\nInstallation\n------------\n\nThe client can be installed using `pip`::\n\n pip install grobid-quantities-client\n\nCommand Line Interface (CLI)\n----------------------------\n\nThe CLI follows the following parameters::\n\n python -m grobid_quantities.quantities --help\n usage: quantities.py [-h] --input INPUT [--output OUTPUT] [--base-url BASE_URL] [--config CONFIG] [--n N] [--force] [--verbose]\n\n Client for the Grobid-quantities service\n\n optional arguments:\n -h, --help show this help message and exit\n --input INPUT path to the directory containing PDF files or .txt (for processCitationList only, one reference per line) to process\n --output OUTPUT path to the directory where to put the results (optional)\n --base-url BASE_URL Base url of the service (without the suffix `/service/`)\n --n N concurrency for service usage\n --force force re-processing pdf input files when tei output files already exist\n\n\n\nAPI Usage\n---------\nInitialisation::\n\n from grobid_quantities.quantities import Quantities\n client = QuantitiesAPI(base_url=http(s)://server_url:port/base/url)\n\n\nProcess raw text::\n\n client.process_text(\n \"I lost two minutes\"\n )\n\nProcess PDF document::\n\n client.process_pdf(pdfFile)\n\n\nParse the measurements::\n\n client.parse_measures(\"from\": \"10\", \"to\": \"20\", \"unit\": \"km\")\n\n\nThe response is a tuple where the first element is the status code and and the second element the response body as a dictionary.\nHere an example::\n\n (\n 200,\n {\n \"runtime\": 123,\n \"measurements\": [\n {\n \"type\": \"value\",\n \"quantity\": {\n \"type\": \"time\",\n \"rawValue\": \"two\",\n \"rawUnit\": {\n \"name\": \"minutes\",\n \"type\": \"time\",\n \"system\": \"non SI\",\n \"offsetStart\": 11,\n \"offsetEnd\": 18\n },\n \"parsedValue\": {\n \"numeric\": 2,\n \"structure\": {\n \"type\": \"ALPHABETIC\",\n \"formatted\": \"two\"\n },\n \"parsed\": \"two\"\n },\n \"normalizedQuantity\": 120,\n \"normalizedUnit\": {\n \"name\": \"s\",\n \"type\": \"time\",\n \"system\": \"SI base\"\n },\n \"offsetStart\": 7,\n \"offsetEnd\": 11\n }\n }\n ]\n }\n )\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "A minimal client for grobid-quantities service.",
"version": "0.4.0",
"split_keywords": [
"measurements",
"text mining",
"tdm",
"grobid"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9b2da07f7176681a6f44a4e4ade8ad32",
"sha256": "1c4d200bf6c01a10f2c6174e25ae769eef62f0da31275cce69b30a0aeecbce92"
},
"downloads": -1,
"filename": "grobid-quantities-client-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "9b2da07f7176681a6f44a4e4ade8ad32",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11105,
"upload_time": "2022-12-15T09:36:13",
"upload_time_iso_8601": "2022-12-15T09:36:13.306140Z",
"url": "https://files.pythonhosted.org/packages/cb/65/592c489e27d0c19ba759577418fe2b97ddb0197fd0811f7d468a311a10ba/grobid-quantities-client-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-15 09:36:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "lfoppiano",
"github_project": "grobid-quantitites-python-client",
"lcname": "grobid-quantities-client"
}