{"id":18038887,"url":"https://github.com/lfoppiano/grobid-quantities-python-client","last_synced_at":"2025-03-27T10:31:54.148Z","repository":{"id":151470110,"uuid":"179438289","full_name":"lfoppiano/grobid-quantities-python-client","owner":"lfoppiano","description":"Python client for Grobid Quantities","archived":false,"fork":false,"pushed_at":"2024-05-21T05:48:16.000Z","size":47,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T15:51:19.488Z","etag":null,"topics":["client","multithread","pdf","python","quantities"],"latest_commit_sha":null,"homepage":"http://github.com/kermitt2/grobid-quantities","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lfoppiano.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-04T06:47:36.000Z","updated_at":"2024-11-09T00:45:52.000Z","dependencies_parsed_at":"2023-05-23T18:30:20.325Z","dependency_job_id":null,"html_url":"https://github.com/lfoppiano/grobid-quantities-python-client","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfoppiano%2Fgrobid-quantities-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfoppiano%2Fgrobid-quantities-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfoppiano%2Fgrobid-quantities-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfoppiano%2Fgrobid-quantities-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lfoppiano","download_url":"https://codeload.github.com/lfoppiano/grobid-quantities-python-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245827004,"owners_count":20678902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","multithread","pdf","python","quantities"],"created_at":"2024-10-30T14:07:39.114Z","updated_at":"2025-03-27T10:31:53.887Z","avatar_url":"https://github.com/lfoppiano.png","language":"Python","readme":"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   )","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfoppiano%2Fgrobid-quantities-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flfoppiano%2Fgrobid-quantities-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfoppiano%2Fgrobid-quantities-python-client/lists"}