grobid-client-python 0.0.15__tar.gz → 0.0.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/PKG-INFO +300 -141
  2. grobid_client_python-0.0.16/Readme.md +378 -0
  3. grobid_client_python-0.0.16/example.py +14 -0
  4. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client/grobid_client.py +132 -94
  5. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client_python.egg-info/PKG-INFO +300 -141
  6. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/pyproject.toml +1 -1
  7. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/test_grobid_client.py +2 -2
  8. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/test_integration.py +4 -4
  9. grobid_client_python-0.0.15/Readme.md +0 -219
  10. grobid_client_python-0.0.15/example.py +0 -5
  11. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/.github/workflows/ci-build.yml +0 -0
  12. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/.github/workflows/ci-release.yml +0 -0
  13. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/.gitignore +0 -0
  14. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/LICENSE +0 -0
  15. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/MANIFEST.in +0 -0
  16. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/config.json +0 -0
  17. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client/__init__.py +0 -0
  18. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client/client.py +0 -0
  19. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client_python.egg-info/SOURCES.txt +0 -0
  20. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client_python.egg-info/dependency_links.txt +0 -0
  21. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client_python.egg-info/entry_points.txt +0 -0
  22. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client_python.egg-info/requires.txt +0 -0
  23. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/grobid_client_python.egg-info/top_level.txt +0 -0
  24. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/pytest.ini +0 -0
  25. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/requirements.txt +0 -0
  26. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/20180928112135.png +0 -0
  27. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/20180928112138.csv +0 -0
  28. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_out/0046d83a-edd6-4631-b57c-755cdcce8b7f.tei.xml +0 -0
  29. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_out/test_1/0f318087-b211-4ace-8ac9-3d9372a73c1c.tei.xml +0 -0
  30. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_pdf/0046d83a-edd6-4631-b57c-755cdcce8b7f.pdf +0 -0
  31. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_pdf/0046d83a-edd6-4631-b57c-755cdcce8b7f.tei.xml +0 -0
  32. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-1.txt +0 -0
  33. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-2.txt +0 -0
  34. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-3.txt +0 -0
  35. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-4.txt +0 -0
  36. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-5.txt +0 -0
  37. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-6.txt +0 -0
  38. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/resources/test_txt/reference-strings-7.txt +0 -0
  39. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/setup.cfg +0 -0
  40. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/__init__.py +0 -0
  41. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/conftest.py +0 -0
  42. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/run_tests.py +0 -0
  43. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/test_client.py +0 -0
  44. {grobid_client_python-0.0.15 → grobid_client_python-0.0.16}/tests/test_config.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grobid-client-python
3
- Version: 0.0.15
3
+ Version: 0.0.16
4
4
  Summary: Simple python client for GROBID REST services
5
5
  Author-email: Patrice Lopez <patrice.lopez@science-miner.com>
6
6
  Maintainer-email: Patrice Lopez <patrice.lopez@science-miner.com>, Luca Foppiano <lucanoro@duck.com>
@@ -214,222 +214,381 @@ Project-URL: Changelog, https://github.com/kermitt2/grobid_client_python
214
214
  Description-Content-Type: text/markdown
215
215
  Requires-Dist: requests
216
216
 
217
+ # GROBID Client Python
218
+
217
219
  [![PyPI version](https://badge.fury.io/py/grobid_client_python.svg)](https://badge.fury.io/py/grobid_client_python)
218
220
  [![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/kermitt2/grobid_client_python/)](https://archive.softwareheritage.org/browse/origin/https://github.com/kermitt2/grobid_client_python/)
219
221
  [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
220
222
 
221
- # Simple Python client for GROBID REST services
222
-
223
- This Python client can be used to process in an efficient concurrent manner a set of PDF in a given directory by the [GROBID](https://github.com/kermitt2/grobid) service. It includes a command line for processing PDF on a file system and write results in a given output directory and a library for import in other python scripts. The client can also process similarly a list of files with reference strings (one per line) and patents in XML ST36 formats.
223
+ A simple, efficient Python client for [GROBID](https://github.com/kermitt2/grobid) REST services that provides concurrent processing capabilities for PDF documents, reference strings, and patents.
224
+
225
+ ## 📋 Table of Contents
226
+
227
+ - [Features](#-features)
228
+ - [Prerequisites](#-prerequisites)
229
+ - [Installation](#-installation)
230
+ - [Quick Start](#-quick-start)
231
+ - [Usage](#-usage)
232
+ - [Command Line Interface](#command-line-interface)
233
+ - [Python Library](#python-library)
234
+ - [Configuration](#-configuration)
235
+ - [Services](#-services)
236
+ - [Testing](#-testing)
237
+ - [Performance](#-performance)
238
+ - [Development](#-development)
239
+ - [License](#-license)
240
+
241
+ ## ✨ Features
242
+
243
+ - **Concurrent Processing**: Efficiently process multiple documents in parallel
244
+ - **Flexible Input**: Process PDF files, text files with references, and XML patents
245
+ - **Configurable**: Customizable server settings, timeouts, and processing options
246
+ - **Command Line & Library**: Use as a standalone CLI tool or import into your Python projects
247
+ - **Coordinate Extraction**: Optional PDF coordinate extraction for precise element positioning
248
+ - **Sentence Segmentation**: Layout-aware sentence segmentation capabilities
249
+
250
+ ## 📋 Prerequisites
251
+
252
+ - **Python**: 3.8 - 3.13 (tested versions)
253
+ - **GROBID Server**: A running GROBID service instance
254
+ - Local installation: [GROBID Documentation](http://grobid.readthedocs.io/)
255
+ - Docker: `docker run -t --rm -p 8070:8070 lfoppiano/grobid:0.8.2`
256
+ - Default server: `http://localhost:8070`
257
+ - Online demo: https://lfoppiano-grobid.hf.space (usage limits apply)
224
258
 
225
259
  > [!IMPORTANT]
226
- > Please be aware that, at the moment, Grobid supports windows only through Docker containers. See [here](https://grobid.readthedocs.io/en/latest/Grobid-docker/).
260
+ > GROBID supports Windows only through Docker containers. See the [Docker documentation](https://grobid.readthedocs.io/en/latest/Grobid-docker/) for details.
227
261
 
228
- ## Build and run
262
+ ## 🚀 Installation
229
263
 
230
- You need first a running *grobid* service, latest stable version, see the [documentation](http://grobid.readthedocs.io/) for installation.
231
- By default, it is assumed that the server will run on the address `http://localhost:8070`.
232
- You can change the server address by editing the file `config.json`, see below.
264
+ Choose one of the following installation methods:
233
265
 
234
- ## Requirements
266
+ ### PyPI (Recommended)
267
+ ```bash
268
+ pip install grobid-client-python
269
+ ```
235
270
 
236
- This client has been developed and was tested with Python `3.8`-`3.13` and should work with any higher `3.*` versions.
237
- It uses `requests` as dependency beyond the Standard Python Library.
271
+ ### Development Version
272
+ ```bash
273
+ pip install git+https://github.com/kermitt2/grobid_client_python.git
274
+ ```
238
275
 
239
- ## Install
276
+ ### Local Development
277
+ ```bash
278
+ git clone https://github.com/kermitt2/grobid_client_python
279
+ cd grobid_client_python
280
+ pip install -e .
281
+ ```
240
282
 
241
- The client can be installed with any of the following ways:
283
+ ## ⚡ Quick Start
242
284
 
243
- * Install *latest stable release* from PyPI:
285
+ ### Command Line
286
+ ```bash
287
+ # Process PDFs in a directory
288
+ grobid_client --input ./pdfs --output ./output processFulltextDocument
244
289
 
245
- ```console
246
- python3 -m pip install grobid-client-python
290
+ # Process with custom server
291
+ grobid_client --server https://your-grobid-server.com --input ./pdfs processFulltextDocument
247
292
  ```
248
293
 
249
- * Install *current master development version* from GitHub:
294
+ ### Python Library
295
+ ```python
296
+ from grobid_client.grobid_client import GrobidClient
297
+
298
+ # Create client instance
299
+ client = GrobidClient(config_path="./config.json")
250
300
 
251
- ```console
252
- python3 -m pip install git+https://github.com/kermitt2/grobid_client_python.git
301
+ # Process documents
302
+ client.process("processFulltextDocument", "/path/to/pdfs", n=10)
253
303
  ```
254
304
 
255
- * Install and build from a clone of the repo (*current master development version*):
305
+ ## 📖 Usage
306
+
307
+ ### Command Line Interface
256
308
 
309
+ The client provides a comprehensive CLI with the following syntax:
310
+
311
+ ```bash
312
+ grobid_client [OPTIONS] SERVICE
257
313
  ```
258
- git clone https://github.com/kermitt2/grobid_client_python
259
- cd grobid_client_python
260
- pip install -e .
314
+
315
+ #### Available Services
316
+
317
+ | Service | Description | Input Format |
318
+ |---------|-------------|--------------|
319
+ | `processFulltextDocument` | Extract full document structure | PDF files |
320
+ | `processHeaderDocument` | Extract document metadata | PDF files |
321
+ | `processReferences` | Extract bibliographic references | PDF files |
322
+ | `processCitationList` | Parse citation strings | Text files (one citation per line) |
323
+ | `processCitationPatentST36` | Process patent citations | XML ST36 format |
324
+ | `processCitationPatentPDF` | Process patent PDFs | PDF files |
325
+
326
+ #### Common Options
327
+
328
+ | Option | Description | Default |
329
+ |--------|-------------|---------|
330
+ | `--input` | Input directory path | Required |
331
+ | `--output` | Output directory path | Same as input |
332
+ | `--server` | GROBID server URL | `http://localhost:8070` |
333
+ | `--n` | Concurrency level | 10 |
334
+ | `--config` | Config file path | Optional |
335
+ | `--force` | Overwrite existing files | False |
336
+ | `--verbose` | Enable verbose logging | False |
337
+
338
+ #### Processing Options
339
+
340
+ | Option | Description |
341
+ |--------|-------------|
342
+ | `--generateIDs` | Generate random XML IDs |
343
+ | `--consolidate_header` | Consolidate header metadata |
344
+ | `--consolidate_citations` | Consolidate bibliographic references |
345
+ | `--include_raw_citations` | Include raw citation text |
346
+ | `--include_raw_affiliations` | Include raw affiliation text |
347
+ | `--teiCoordinates` | Add PDF coordinates to XML |
348
+ | `--segmentSentences` | Segment sentences with coordinates |
349
+ | `--flavor` | Processing flavor for fulltext extraction |
350
+
351
+ #### Examples
352
+
353
+ ```bash
354
+ # Basic fulltext processing
355
+ grobid_client --input ~/documents --output ~/results processFulltextDocument
356
+
357
+ # High concurrency with coordinates
358
+ grobid_client --input ~/pdfs --output ~/tei --n 20 --teiCoordinates processFulltextDocument
359
+
360
+ # Process citations with custom server
361
+ grobid_client --server https://grobid.example.com --input ~/citations.txt processCitationList
362
+
363
+ # Force reprocessing with sentence segmentation
364
+ grobid_client --input ~/docs --force --segmentSentences processFulltextDocument
261
365
  ```
262
366
 
263
- There is nothing more needed to start using the python command lines, see the next section.
367
+ ### Python Library
264
368
 
265
- ## Usage and options
369
+ #### Basic Usage
266
370
 
267
- The call to the script can normally be realized interchangeably with `python3 -m grobid_client.grobid_client` or simply `grobid_client`.
371
+ ```python
372
+ from grobid_client.grobid_client import GrobidClient
268
373
 
269
- ```
270
- usage: grobid_client [-h] [--input INPUT] [--output OUTPUT] [--config CONFIG]
271
- [--n N] [--generateIDs] [--consolidate_header]
272
- [--consolidate_citations] [--include_raw_citations]
273
- [--include_raw_affiliations] [--force] [--teiCoordinates]
274
- [--verbose] [--flavor FLAVOR]
275
- service
276
-
277
- Client for GROBID services
278
-
279
- positional arguments:
280
- service one of ['processFulltextDocument',
281
- 'processHeaderDocument', 'processReferences',
282
- 'processCitationList','processCitationPatentST36',
283
- 'processCitationPatentPDF']
284
-
285
- optional arguments:
286
- -h, --help show this help message and exit
287
- --input INPUT path to the directory containing PDF files or .txt
288
- (for processCitationList only, one reference per line)
289
- to process
290
- --output OUTPUT path to the directory where to put the results
291
- (optional)
292
- --config CONFIG path to the config file, default is ./config.json
293
- --n N concurrency for service usage
294
- --generateIDs generate random xml:id to textual XML elements of the
295
- result files
296
- --consolidate_header call GROBID with consolidation of the metadata
297
- extracted from the header
298
- --consolidate_citations
299
- call GROBID with consolidation of the extracted
300
- bibliographical references
301
- --include_raw_citations
302
- call GROBID requesting the extraction of raw citations
303
- --include_raw_affiliations
304
- call GROBID requestiong the extraciton of raw
305
- affiliations
306
- --force force re-processing pdf input files when tei output
307
- files already exist
308
- --teiCoordinates add the original PDF coordinates (bounding boxes) to
309
- the extracted elements
310
- --segmentSentences segment sentences in the text content of the document
311
- with additional <s> elements
312
- --verbose print information about processed files in the console
313
- --flavor specifcy the flavor to be used. Current accepted
314
- values: `article/light`, `article/light-ref`, `sdo/ietf`.
315
- ```
374
+ # Initialize with default localhost server
375
+ client = GrobidClient()
316
376
 
317
- > [!TIP]
318
- > Before using flavors, check [here](https://grobid.readthedocs.io/en/latest/Grobid-specialized-processes/#flavors).
377
+ # Initialize with custom server
378
+ client = GrobidClient(grobid_server="https://your-server.com")
379
+
380
+ # Initialize with config file
381
+ client = GrobidClient(config_path="./config.json")
319
382
 
383
+ # Process documents
384
+ client.process(
385
+ service="processFulltextDocument",
386
+ input_path="/path/to/pdfs",
387
+ output_path="/path/to/output",
388
+ n=20
389
+ )
390
+ ```
320
391
 
321
- Examples:
392
+ #### Advanced Usage
322
393
 
323
- ```console
324
- > grobid_client --input ~/tmp/in2 --output ~/tmp/out processFulltextDocument
394
+ ```python
395
+ # Process with specific options
396
+ client.process(
397
+ service="processFulltextDocument",
398
+ input_path="/path/to/pdfs",
399
+ output_path="/path/to/output",
400
+ n=10,
401
+ generateIDs=True,
402
+ consolidate_header=True,
403
+ teiCoordinates=True,
404
+ segmentSentences=True
405
+ )
406
+
407
+ # Process citation lists
408
+ client.process(
409
+ service="processCitationList",
410
+ input_path="/path/to/citations.txt",
411
+ output_path="/path/to/output"
412
+ )
325
413
  ```
326
414
 
327
- This command will process all the PDF files present under the input directory recursively (files with extension `.pdf` only) with the `processFulltextDocument` service of GROBID, and write the resulting XML TEI files under the output directory, reusing the file name with a different file extension (`.grobid.tei.xml`), using the default `10` concurrent workers.
415
+ ## ⚙️ Configuration
416
+
417
+ Configuration can be provided via a JSON file. When using the CLI, the `--server` argument overrides the config file settings.
328
418
 
329
- If `--output` is omitted, the resulting XML TEI documents will be produced alongside the PDF in the `--input` directory.
419
+ ### Default Configuration
330
420
 
331
- ```console
332
- > grobid_client --input ~/tmp/in2 --output ~/tmp/out --n 20 processHeaderDocument
421
+ ```json
422
+ {
423
+ "grobid_server": "http://localhost:8070",
424
+ "batch_size": 1000,
425
+ "sleep_time": 5,
426
+ "timeout": 60,
427
+ "coordinates": ["persName", "figure", "ref", "biblStruct", "formula", "s"]
428
+ }
333
429
  ```
334
430
 
335
- This command will process all the PDF files present in the input directory (files with extension `.pdf` only) with the `processHeaderDocument` service of GROBID, and write the resulting XML TEI files under the output directory, reusing the file name with a different file extension (`.grobid.tei.xml`), using `20` concurrent workers.
431
+ ### Configuration Parameters
336
432
 
337
- By default if an existing `.grobid.tei.xml` file is present in the output directory corresponding to a PDF in the input directory, this PDF will be skipped to avoid reprocessing several times the same PDF. To force the processing of PDF and over-write of existing TEI files, use the parameter `--force`.
433
+ | Parameter | Description | Default |
434
+ |-----------|-------------|---------|
435
+ | `grobid_server` | GROBID server URL | `http://localhost:8070` |
436
+ | `batch_size` | Thread pool size | 1000 |
437
+ | `sleep_time` | Wait time when server is busy (seconds) | 5 |
438
+ | `timeout` | Client-side timeout (seconds) | 60 |
439
+ | `coordinates` | XML elements for coordinate extraction | See above |
338
440
 
339
- `processCitationList` does not take a repertory of PDF as input, but a repertory of `.txt` files, with one reference raw string per line, for example:
441
+ > [!TIP]
442
+ > Since version 0.0.12, the config file is optional. The client will use default localhost settings if no configuration is provided.
340
443
 
341
- ```console
342
- > grobid_client --input resources/test_txt/ --output resources/test_out/ --n 20 processCitationList
343
- ```
444
+ ## 🔬 Services
344
445
 
345
- The following command example will process all the PDF files present in the input directory and add bounding box coordinates (`--teiCoordinates`) relative to the original PDFs for the elements listed in the config file. It will also segment the sentences (`--segmentSentences`, this is a "layout aware" sentence segmentation) in the identified paragraphs with bounding box coordinates for the sentences.
446
+ ### Fulltext Document Processing
447
+ Extracts complete document structure including headers, body text, figures, tables, and references.
346
448
 
347
- ```console
348
- > grobid_client --input ~/tmp/in2 --output ~/tmp/out --teiCoordinates --segmentSentences processFulltextDocument
449
+ ```bash
450
+ grobid_client --input pdfs/ --output results/ processFulltextDocument
349
451
  ```
350
452
 
351
- The file `example.py` gives an example of usage as a library, from a another python script.
453
+ ### Header Document Processing
454
+ Extracts only document metadata (title, authors, abstract, etc.).
352
455
 
353
- ## Using the client in your python
354
-
355
- Import and call the client as follow:
456
+ ```bash
457
+ grobid_client --input pdfs/ --output headers/ processHeaderDocument
458
+ ```
356
459
 
357
- ```python
358
- from grobid_client.grobid_client import GrobidClient
460
+ ### Reference Processing
461
+ Extracts and structures bibliographic references from documents.
359
462
 
360
- client = GrobidClient(config_path="./config.json")
361
- client.process("processFulltextDocument", "/mnt/data/covid/pdfs", n=20)
463
+ ```bash
464
+ grobid_client --input pdfs/ --output refs/ processReferences
362
465
  ```
363
466
 
364
- See also `example.py`.
467
+ ### Citation List Processing
468
+ Parses raw citation strings from text files.
365
469
 
366
- ## Configuration of the client
470
+ ```bash
471
+ grobid_client --input citations.txt --output parsed/ processCitationList
472
+ ```
367
473
 
368
474
  > [!TIP]
369
- > from version 0.0.12 the `config.json` will be optional, by default the client will connect to the local server (`http://localhost:8070`).
475
+ > For citation lists, input should be text files with one citation string per line.
370
476
 
371
- There are a few parameters that can be set with the `config.json` file.
477
+ ## 🧪 Testing
372
478
 
373
- - `grobid_server` indicates the URL of the GROBID server to be used by the client.
479
+ The project includes comprehensive unit and integration tests using pytest.
374
480
 
375
- - `batch_size` is the the size of the pool of threads used by ThreadPoolExecutor, you normally don't want to change this. This should be a high number (default 1000) - but not too high to protect the memory on the machine running the client. This should not be confused with the concurrency parameter `n` which indicates how many parallel requests can be send to GROBID.
481
+ ### Running Tests
376
482
 
377
- - `sleep_time` indicates in seconds the time to wait for sending a new request to GROBID when the server indicates that all its threads are currently used. The client need to re-send the query after a wait time that will allow the server to free some threads. This wait time usually depends on the service and the capacities of the server, we suggest 5-10 seconds for the `processFulltextDocument` service and 2 seconds for `processHeaderDocument` service.
483
+ ```bash
484
+ # Install development dependencies
485
+ pip install -e .[dev]
378
486
 
379
- - `timeout` is a client side timeout - the process on server side will still be running until the server finished the task or the server timeout is reached.
487
+ # Run all tests
488
+ pytest
380
489
 
381
- - `coordinates` indicates the structure XML elements that should contains PDF coordinates when the parameters `--teiCoordinates` is used see [here](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/) for more details.
490
+ # Run with coverage
491
+ pytest --cov=grobid_client
382
492
 
383
- Here is the default `config.json` file for the client:
493
+ # Run specific test file
494
+ pytest tests/test_client.py
384
495
 
496
+ # Run with verbose output
497
+ pytest -v
385
498
  ```
386
- {
387
- "grobid_server": "http://localhost:8070",
388
- "batch_size": 1000,
389
- "sleep_time": 5,
390
- "timeout": 60,
391
- "coordinates": [ "persName", "figure", "ref", "biblStruct", "formula", "s" ]
392
- }
393
- ```
394
499
 
395
- ## Benchmarking
500
+ ### Test Structure
501
+
502
+ - `tests/test_client.py` - Unit tests for the base API client
503
+ - `tests/test_grobid_client.py` - Unit tests for the GROBID client
504
+ - `tests/test_integration.py` - Integration tests with real GROBID server
505
+ - `tests/conftest.py` - Test configuration and fixtures
396
506
 
397
- 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:
507
+ ### Continuous Integration
398
508
 
399
- | n | runtime (s)| s/PDF | PDF/s |
400
- |----|------------|-------|-------|
401
- | 1 | 209.0 | 1.54 | 0.65 |
402
- | 2 | 112.0 | 0.82 | 1.21 |
403
- | 3 | 80.4 | 0.59 | 1.69 |
404
- | 5 | 62.9 | 0.46 | 2.16 |
405
- | 8 | 55.7 | 0.41 | 2.44 |
406
- | 10 | 55.3 | 0.40 | 2.45 |
509
+ Tests are automatically run via GitHub Actions on:
510
+ - Push to main branch
511
+ - Pull requests
512
+ - Multiple Python versions (3.8-3.13)
513
+
514
+ ## 📊 Performance
515
+
516
+ Benchmark results for processing **136 PDFs** (3,443 pages total, ~25 pages per PDF) on Intel Core i7-4790K CPU 4.00GHz:
517
+
518
+ | Concurrency | Runtime (s) | s/PDF | PDF/s |
519
+ |-------------|-------------|-------|-------|
520
+ | 1 | 209.0 | 1.54 | 0.65 |
521
+ | 2 | 112.0 | 0.82 | 1.21 |
522
+ | 3 | 80.4 | 0.59 | 1.69 |
523
+ | 5 | 62.9 | 0.46 | 2.16 |
524
+ | 8 | 55.7 | 0.41 | 2.44 |
525
+ | 10 | 55.3 | 0.40 | 2.45 |
407
526
 
408
527
  ![Runtime Plot](resources/20180928112135.png)
409
528
 
410
- As complementary info, GROBID processing of header of the 136 PDF and with `n=10` takes 3.74 s (15 times faster than the complete full text processing because only the two first pages of the PDF are considered), 36 PDF/s.
529
+ ### Additional Benchmarks
530
+
531
+ - **Header processing**: 3.74s for 136 PDFs (36 PDF/s) with n=10
532
+ - **Reference extraction**: 26.9s for 136 PDFs (5.1 PDF/s) with n=10
533
+ - **Citation parsing**: 4.3s for 3,500 citations (814 citations/s) with n=10
411
534
 
412
- In similar conditions, extraction and structuring of bibliographical references takes 26.9 s (5.1 PDF/s).
535
+ ## 🛠️ Development
413
536
 
414
- Processing of 3500 raw bibliographical take 4.3 s with `n=10` (814 references parsed per second).
537
+ ### Setting Up Development Environment
415
538
 
539
+ ```bash
540
+ # Clone the repository
541
+ git clone https://github.com/kermitt2/grobid_client_python
542
+ cd grobid_client_python
416
543
 
417
- ## Developer notes
544
+ # Create virtual environment
545
+ python -m venv venv
546
+ source venv/bin/activate # On Windows: venv\Scripts\activate
418
547
 
419
- ### New release
548
+ # Install in development mode with test dependencies
549
+ pip install -e .[dev]
550
+
551
+ # Install pre-commit hooks (optional)
552
+ pre-commit install
553
+ ```
420
554
 
421
- New releases can be published by using `bump-my-version`:
555
+ ### Creating a New Release
422
556
 
423
- ```shell
557
+ The project uses `bump-my-version` for version management:
558
+
559
+ ```bash
560
+ # Install bump-my-version
424
561
  pip install bump-my-version
425
- bump-my-version bump patch
562
+
563
+ # Bump version (patch, minor, or major)
564
+ bump-my-version bump patch
565
+
566
+ # The release will be automatically published to PyPI
426
567
  ```
427
568
 
428
- Use of `major`, `minor`, or `patch` or will increment the first, second or the third digit of the version, respectively.
429
- The release will be published automatically on pypy.
569
+ ### Contributing
570
+
571
+ 1. Fork the repository
572
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
573
+ 3. Make your changes
574
+ 4. Add tests for new functionality
575
+ 5. Run the test suite (`pytest`)
576
+ 6. Commit your changes (`git commit -m 'Add amazing feature'`)
577
+ 7. Push to the branch (`git push origin feature/amazing-feature`)
578
+ 8. Open a Pull Request
579
+
580
+ ## 📄 License
581
+
582
+ Distributed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0). See `LICENSE` for more information.
583
+
584
+ ## 👥 Authors & Contact
430
585
 
431
- ## License and contact
586
+ **Main Author**: Patrice Lopez (patrice.lopez@science-miner.com)
587
+ **Maintainer**: Luca Foppiano (luca@sciencialab.com)
432
588
 
433
- Distributed under [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0).
589
+ ## 🔗 Links
434
590
 
435
- Main author and contact: Patrice Lopez (<patrice.lopez@science-miner.com>)
591
+ - [GROBID Documentation](https://grobid.readthedocs.io/)
592
+ - [PyPI Package](https://pypi.org/project/grobid-client-python/)
593
+ - [GitHub Repository](https://github.com/kermitt2/grobid_client_python)
594
+ - [Issue Tracker](https://github.com/kermitt2/grobid_client_python/issues)