grobid-client-python 0.0.17__tar.gz → 0.1.0__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.
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/PKG-INFO +318 -20
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/Readme.md +314 -19
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/config.json +1 -1
- grobid_client_python-0.1.0/grobid_client/format/TEI2LossyJSON.py +1006 -0
- grobid_client_python-0.1.0/grobid_client/format/TEI2Markdown.py +707 -0
- grobid_client_python-0.1.0/grobid_client/format/__init__.py +0 -0
- grobid_client_python-0.1.0/grobid_client/format/validate_json_refs.py +378 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client/grobid_client.py +179 -44
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client_python.egg-info/PKG-INFO +318 -20
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client_python.egg-info/SOURCES.txt +19 -3
- grobid_client_python-0.1.0/grobid_client_python.egg-info/requires.txt +4 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/pyproject.toml +1 -1
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/pytest.ini +1 -0
- grobid_client_python-0.1.0/requirements.txt +4 -0
- grobid_client_python-0.1.0/tests/resources/__init__.py +3 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1038_s41477-023-01501-1.grobid.tei.xml +1730 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1038_s41477-023-01501-1.json +2251 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1038_s41586-023-05895-y.grobid.tei.xml +1998 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1038_s41586-023-05895-y.json +2364 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1038_s41598-023-32039-z.grobid.tei.xml +1286 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1038_s41598-023-32039-z.json +2049 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1371_journal.pone.0218311.grobid.tei.xml +1377 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.1371_journal.pone.0218311.json +2120 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.7554_elife.78558.grobid.tei.xml +3354 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/10.7554_elife.78558.json +3529 -0
- grobid_client_python-0.1.0/tests/resources/refs_offsets/bao.json +2364 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/test_config.json +1 -1
- grobid_client_python-0.1.0/tests/test_conversions.py +623 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/test_grobid_client.py +239 -6
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/test_integration.py +2 -3
- grobid_client_python-0.0.17/grobid_client_python.egg-info/requires.txt +0 -1
- grobid_client_python-0.0.17/requirements.txt +0 -1
- grobid_client_python-0.0.17/resources/test_out/test_1/0f318087-b211-4ace-8ac9-3d9372a73c1c.tei.xml +0 -1094
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/.github/workflows/ci-build.yml +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/.github/workflows/ci-release.yml +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/.gitignore +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/LICENSE +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/MANIFEST.in +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/example.py +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client/__init__.py +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client/client.py +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client_python.egg-info/dependency_links.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client_python.egg-info/entry_points.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/grobid_client_python.egg-info/top_level.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/20180928112135.png +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/20180928112138.csv +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_pdf/0046d83a-edd6-4631-b57c-755cdcce8b7f.pdf +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_pdf/0046d83a-edd6-4631-b57c-755cdcce8b7f.tei.xml +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-1.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-2.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-3.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-4.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-5.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-6.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/resources/test_txt/reference-strings-7.txt +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/setup.cfg +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/__init__.py +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/conftest.py +0 -0
- {grobid_client_python-0.0.17/resources/test_out → grobid_client_python-0.1.0/tests/resources}/0046d83a-edd6-4631-b57c-755cdcce8b7f.tei.xml +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/run_tests.py +0 -0
- {grobid_client_python-0.0.17 → grobid_client_python-0.1.0}/tests/test_client.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: grobid-client-python
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
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>
|
|
@@ -213,6 +213,9 @@ Project-URL: Repository, https://github.com/kermitt2/grobid_client_python
|
|
|
213
213
|
Project-URL: Changelog, https://github.com/kermitt2/grobid_client_python
|
|
214
214
|
Description-Content-Type: text/markdown
|
|
215
215
|
Requires-Dist: requests
|
|
216
|
+
Requires-Dist: dateparser
|
|
217
|
+
Requires-Dist: beautifulsoup4
|
|
218
|
+
Requires-Dist: lxml
|
|
216
219
|
|
|
217
220
|
# GROBID Client Python
|
|
218
221
|
|
|
@@ -220,7 +223,8 @@ Requires-Dist: requests
|
|
|
220
223
|
[](https://archive.softwareheritage.org/browse/origin/https://github.com/kermitt2/grobid_client_python/)
|
|
221
224
|
[](http://www.apache.org/licenses/LICENSE-2.0.html)
|
|
222
225
|
|
|
223
|
-
A simple, efficient Python client for [GROBID](https://github.com/kermitt2/grobid) REST services that provides
|
|
226
|
+
A simple, efficient Python client for [GROBID](https://github.com/kermitt2/grobid) REST services that provides
|
|
227
|
+
concurrent processing capabilities for PDF documents, reference strings, and patents.
|
|
224
228
|
|
|
225
229
|
## 📋 Table of Contents
|
|
226
230
|
|
|
@@ -229,8 +233,8 @@ A simple, efficient Python client for [GROBID](https://github.com/kermitt2/grobi
|
|
|
229
233
|
- [Installation](#-installation)
|
|
230
234
|
- [Quick Start](#-quick-start)
|
|
231
235
|
- [Usage](#-usage)
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
- [Command Line Interface](#command-line-interface)
|
|
237
|
+
- [Python Library](#python-library)
|
|
234
238
|
- [Configuration](#-configuration)
|
|
235
239
|
- [Services](#-services)
|
|
236
240
|
- [Testing](#-testing)
|
|
@@ -246,34 +250,42 @@ A simple, efficient Python client for [GROBID](https://github.com/kermitt2/grobi
|
|
|
246
250
|
- **Command Line & Library**: Use as a standalone CLI tool or import into your Python projects
|
|
247
251
|
- **Coordinate Extraction**: Optional PDF coordinate extraction for precise element positioning
|
|
248
252
|
- **Sentence Segmentation**: Layout-aware sentence segmentation capabilities
|
|
253
|
+
- **JSON Output**: Convert TEI XML output to structured JSON format with CORD-19-like structure
|
|
254
|
+
- **Markdown Output**: Convert TEI XML output to clean Markdown format with structured sections
|
|
249
255
|
|
|
250
256
|
## 📋 Prerequisites
|
|
251
257
|
|
|
252
258
|
- **Python**: 3.8 - 3.13 (tested versions)
|
|
253
259
|
- **GROBID Server**: A running GROBID service instance
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
- Local installation: [GROBID Documentation](http://grobid.readthedocs.io/)
|
|
261
|
+
- Docker: `docker run -t --rm -p 8070:8070 lfoppiano/grobid:0.8.2`
|
|
262
|
+
- Default server: `http://localhost:8070`
|
|
263
|
+
- Online demo: https://lfoppiano-grobid.hf.space (usage limits apply), more
|
|
264
|
+
details [here](https://grobid.readthedocs.io/en/latest/getting_started/#using-grobid-from-the-cloud).
|
|
265
|
+
|
|
258
266
|
|
|
259
267
|
> [!IMPORTANT]
|
|
260
|
-
> GROBID supports Windows only through Docker containers. See
|
|
268
|
+
> GROBID supports Windows only through Docker containers. See
|
|
269
|
+
> the [Docker documentation](https://grobid.readthedocs.io/en/latest/Grobid-docker/) for details.
|
|
261
270
|
|
|
262
271
|
## 🚀 Installation
|
|
263
272
|
|
|
264
273
|
Choose one of the following installation methods:
|
|
265
274
|
|
|
266
275
|
### PyPI (Recommended)
|
|
276
|
+
|
|
267
277
|
```bash
|
|
268
278
|
pip install grobid-client-python
|
|
269
279
|
```
|
|
270
280
|
|
|
271
281
|
### Development Version
|
|
282
|
+
|
|
272
283
|
```bash
|
|
273
284
|
pip install git+https://github.com/kermitt2/grobid_client_python.git
|
|
274
285
|
```
|
|
275
286
|
|
|
276
287
|
### Local Development
|
|
288
|
+
|
|
277
289
|
```bash
|
|
278
290
|
git clone https://github.com/kermitt2/grobid_client_python
|
|
279
291
|
cd grobid_client_python
|
|
@@ -283,6 +295,7 @@ pip install -e .
|
|
|
283
295
|
## ⚡ Quick Start
|
|
284
296
|
|
|
285
297
|
### Command Line
|
|
298
|
+
|
|
286
299
|
```bash
|
|
287
300
|
# Process PDFs in a directory
|
|
288
301
|
grobid_client --input ./pdfs --output ./output processFulltextDocument
|
|
@@ -292,6 +305,7 @@ grobid_client --server https://your-grobid-server.com --input ./pdfs processFull
|
|
|
292
305
|
```
|
|
293
306
|
|
|
294
307
|
### Python Library
|
|
308
|
+
|
|
295
309
|
```python
|
|
296
310
|
from grobid_client.grobid_client import GrobidClient
|
|
297
311
|
|
|
@@ -347,6 +361,9 @@ grobid_client [OPTIONS] SERVICE
|
|
|
347
361
|
| `--teiCoordinates` | Add PDF coordinates to XML |
|
|
348
362
|
| `--segmentSentences` | Segment sentences with coordinates |
|
|
349
363
|
| `--flavor` | Processing flavor for fulltext extraction |
|
|
364
|
+
| `--json` | Convert TEI output to JSON format |
|
|
365
|
+
| `--markdown` | Convert TEI output to Markdown format |
|
|
366
|
+
|
|
350
367
|
|
|
351
368
|
#### Examples
|
|
352
369
|
|
|
@@ -357,11 +374,17 @@ grobid_client --input ~/documents --output ~/results processFulltextDocument
|
|
|
357
374
|
# High concurrency with coordinates
|
|
358
375
|
grobid_client --input ~/pdfs --output ~/tei --n 20 --teiCoordinates processFulltextDocument
|
|
359
376
|
|
|
377
|
+
# Process with JSON output
|
|
378
|
+
grobid_client --input ~/pdfs --output ~/results --json processFulltextDocument
|
|
379
|
+
|
|
380
|
+
# Process with Markdown output
|
|
381
|
+
grobid_client --input ~/pdfs --output ~/results --markdown processFulltextDocument
|
|
382
|
+
|
|
360
383
|
# Process citations with custom server
|
|
361
384
|
grobid_client --server https://grobid.example.com --input ~/citations.txt processCitationList
|
|
362
385
|
|
|
363
|
-
# Force reprocessing with sentence segmentation
|
|
364
|
-
grobid_client --input ~/docs --force --segmentSentences processFulltextDocument
|
|
386
|
+
# Force reprocessing with sentence segmentation and JSON output
|
|
387
|
+
grobid_client --input ~/docs --force --segmentSentences --json processFulltextDocument
|
|
365
388
|
```
|
|
366
389
|
|
|
367
390
|
### Python Library
|
|
@@ -404,6 +427,22 @@ client.process(
|
|
|
404
427
|
segmentSentences=True
|
|
405
428
|
)
|
|
406
429
|
|
|
430
|
+
# Process with JSON output
|
|
431
|
+
client.process(
|
|
432
|
+
service="processFulltextDocument",
|
|
433
|
+
input_path="/path/to/pdfs",
|
|
434
|
+
output_path="/path/to/output",
|
|
435
|
+
json_output=True
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
# Process with Markdown output
|
|
439
|
+
client.process(
|
|
440
|
+
service="processFulltextDocument",
|
|
441
|
+
input_path="/path/to/pdfs",
|
|
442
|
+
output_path="/path/to/output",
|
|
443
|
+
markdown_output=True
|
|
444
|
+
)
|
|
445
|
+
|
|
407
446
|
# Process citation lists
|
|
408
447
|
client.process(
|
|
409
448
|
service="processCitationList",
|
|
@@ -414,17 +453,25 @@ client.process(
|
|
|
414
453
|
|
|
415
454
|
## ⚙️ Configuration
|
|
416
455
|
|
|
417
|
-
Configuration can be provided via a JSON file. When using the CLI, the `--server` argument overrides the config file
|
|
456
|
+
Configuration can be provided via a JSON file. When using the CLI, the `--server` argument overrides the config file
|
|
457
|
+
settings.
|
|
418
458
|
|
|
419
459
|
### Default Configuration
|
|
420
460
|
|
|
421
461
|
```json
|
|
422
462
|
{
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
463
|
+
"grobid_server": "http://localhost:8070",
|
|
464
|
+
"batch_size": 1000,
|
|
465
|
+
"sleep_time": 5,
|
|
466
|
+
"timeout": 60,
|
|
467
|
+
"coordinates": [
|
|
468
|
+
"persName",
|
|
469
|
+
"figure",
|
|
470
|
+
"ref",
|
|
471
|
+
"biblStruct",
|
|
472
|
+
"formula",
|
|
473
|
+
"s"
|
|
474
|
+
]
|
|
428
475
|
}
|
|
429
476
|
```
|
|
430
477
|
|
|
@@ -437,20 +484,267 @@ Configuration can be provided via a JSON file. When using the CLI, the `--server
|
|
|
437
484
|
| `sleep_time` | Wait time when server is busy (seconds) | 5 |
|
|
438
485
|
| `timeout` | Client-side timeout (seconds) | 180 |
|
|
439
486
|
| `coordinates` | XML elements for coordinate extraction | See above |
|
|
487
|
+
| `logging` | Logging configuration (level, format, file output) | See Logging section |
|
|
440
488
|
|
|
441
489
|
> [!TIP]
|
|
442
|
-
> Since version 0.0.12, the config file is optional. The client will use default localhost settings if no configuration
|
|
490
|
+
> Since version 0.0.12, the config file is optional. The client will use default localhost settings if no configuration
|
|
491
|
+
> is provided.
|
|
492
|
+
|
|
493
|
+
### Logging Configuration
|
|
494
|
+
|
|
495
|
+
The client provides configurable logging with different verbosity levels. By default, only essential statistics and warnings are shown.
|
|
496
|
+
|
|
497
|
+
#### Logging Behavior
|
|
498
|
+
|
|
499
|
+
- **Without `--verbose`**: Shows only essential information and warnings/errors
|
|
500
|
+
- **With `--verbose`**: Shows detailed processing information at INFO level
|
|
501
|
+
|
|
502
|
+
#### Always Visible Output
|
|
503
|
+
|
|
504
|
+
The following information is always displayed regardless of the `--verbose` flag:
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
Found 1000 file(s) to process
|
|
508
|
+
Processing completed: 950 out of 1000 files processed
|
|
509
|
+
Errors: 50 out of 1000 files processed
|
|
510
|
+
Processing completed in 120.5 seconds
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
#### Verbose Output (`--verbose`)
|
|
514
|
+
|
|
515
|
+
When the `--verbose` flag is used, additional detailed information is displayed:
|
|
516
|
+
|
|
517
|
+
- Server connection status
|
|
518
|
+
- Individual file processing details
|
|
519
|
+
- JSON conversion messages
|
|
520
|
+
- Detailed error messages
|
|
521
|
+
- Processing progress information
|
|
522
|
+
|
|
523
|
+
#### Examples
|
|
524
|
+
|
|
525
|
+
```bash
|
|
526
|
+
# Clean output - only essential statistics
|
|
527
|
+
grobid_client --input pdfs/ processFulltextDocument
|
|
528
|
+
# Output:
|
|
529
|
+
# Found 1000 file(s) to process
|
|
530
|
+
# Processing completed: 950 out of 1000 files processed
|
|
531
|
+
# Errors: 50 out of 1000 files processed
|
|
532
|
+
# Processing completed in 120.5 seconds
|
|
533
|
+
|
|
534
|
+
# Verbose output - detailed processing information
|
|
535
|
+
grobid_client --input pdfs/ --verbose processFulltextDocument
|
|
536
|
+
# Output includes all essential stats PLUS:
|
|
537
|
+
# GROBID server http://localhost:8070 is up and running
|
|
538
|
+
# JSON file example.json does not exist, generating JSON from existing TEI...
|
|
539
|
+
# Successfully created JSON file: example.json
|
|
540
|
+
# ... and other detailed processing information
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
#### Configuration File Logging
|
|
544
|
+
|
|
545
|
+
The config file can include logging settings:
|
|
546
|
+
|
|
547
|
+
```json
|
|
548
|
+
{
|
|
549
|
+
"grobid_server": "http://localhost:8070",
|
|
550
|
+
"logging": {
|
|
551
|
+
"level": "WARNING",
|
|
552
|
+
"format": "%(asctime)s - %(levelname)s - %(message)s",
|
|
553
|
+
"console": true,
|
|
554
|
+
"file": null
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
**Note**: The `--verbose` command line flag always takes precedence over configuration file logging settings.
|
|
443
560
|
|
|
444
561
|
## 🔬 Services
|
|
445
562
|
|
|
446
563
|
### Fulltext Document Processing
|
|
564
|
+
|
|
447
565
|
Extracts complete document structure including headers, body text, figures, tables, and references.
|
|
448
566
|
|
|
449
567
|
```bash
|
|
450
568
|
grobid_client --input pdfs/ --output results/ processFulltextDocument
|
|
451
569
|
```
|
|
452
570
|
|
|
571
|
+
### JSON Output Format
|
|
572
|
+
|
|
573
|
+
When using the `--json` flag, the client converts TEI XML output to a structured JSON format similar to CORD-19. This provides:
|
|
574
|
+
|
|
575
|
+
- **Structured Bibliography**: Title, authors, DOI, publication date, journal information
|
|
576
|
+
- **Body Text**: Paragraphs and sentences with metadata and reference annotations
|
|
577
|
+
- **Figures and Tables**: Structured JSON format for tables with headers, rows, and metadata
|
|
578
|
+
- **Reference Information**: In-text citations with offsets and targets
|
|
579
|
+
|
|
580
|
+
#### JSON Structure
|
|
581
|
+
|
|
582
|
+
```json
|
|
583
|
+
{
|
|
584
|
+
"level": "paragraph",
|
|
585
|
+
"biblio": {
|
|
586
|
+
"title": "Document Title",
|
|
587
|
+
"authors": [
|
|
588
|
+
"Author 1",
|
|
589
|
+
"Author 2"
|
|
590
|
+
],
|
|
591
|
+
"doi": "10.1000/example",
|
|
592
|
+
"publication_date": "2023-01-01",
|
|
593
|
+
"journal": "Journal Name",
|
|
594
|
+
"abstract": [
|
|
595
|
+
...
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
"body_text": [
|
|
599
|
+
{
|
|
600
|
+
"id": "p_12345",
|
|
601
|
+
"text": "Paragraph text with citations [1].",
|
|
602
|
+
"head_section": "Introduction",
|
|
603
|
+
"refs": [
|
|
604
|
+
{
|
|
605
|
+
"type": "bibr",
|
|
606
|
+
"target": "b1",
|
|
607
|
+
"text": "[1]",
|
|
608
|
+
"offset_start": 25,
|
|
609
|
+
"offset_end": 28
|
|
610
|
+
}
|
|
611
|
+
]
|
|
612
|
+
}
|
|
613
|
+
],
|
|
614
|
+
"figures_and_tables": [
|
|
615
|
+
{
|
|
616
|
+
"id": "table_1",
|
|
617
|
+
"type": "table",
|
|
618
|
+
"label": "Table 1",
|
|
619
|
+
"head": "Sample Data",
|
|
620
|
+
"content": {
|
|
621
|
+
"headers": [
|
|
622
|
+
"Header 1",
|
|
623
|
+
"Header 2"
|
|
624
|
+
],
|
|
625
|
+
"rows": [
|
|
626
|
+
[
|
|
627
|
+
"Value 1",
|
|
628
|
+
"Value 2"
|
|
629
|
+
]
|
|
630
|
+
],
|
|
631
|
+
"metadata": {
|
|
632
|
+
"row_count": 1,
|
|
633
|
+
"column_count": 2,
|
|
634
|
+
"has_headers": true
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
#### Usage Examples
|
|
643
|
+
|
|
644
|
+
```bash
|
|
645
|
+
# Generate both TEI and JSON outputs
|
|
646
|
+
grobid_client --input pdfs/ --output results/ --json processFulltextDocument
|
|
647
|
+
|
|
648
|
+
# JSON output with coordinates and sentence segmentation
|
|
649
|
+
grobid_client --input pdfs/ --output results/ --json --teiCoordinates --segmentSentences processFulltextDocument
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
```python
|
|
653
|
+
# Python library usage
|
|
654
|
+
client.process(
|
|
655
|
+
service="processFulltextDocument",
|
|
656
|
+
input_path="/path/to/pdfs",
|
|
657
|
+
output_path="/path/to/output",
|
|
658
|
+
json_output=True
|
|
659
|
+
)
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
> [!NOTE]
|
|
663
|
+
> When using `--json`, the `--force` flag only checks for existing TEI files. If a TEI file is rewritten (due to
|
|
664
|
+
`--force`), the corresponding JSON file is automatically rewritten as well.
|
|
665
|
+
|
|
666
|
+
### Markdown Output Format
|
|
667
|
+
|
|
668
|
+
When using the `--markdown` flag, the client converts TEI XML output to a clean, readable Markdown format. This
|
|
669
|
+
provides:
|
|
670
|
+
|
|
671
|
+
- **Structured Sections**: Title, Authors, Affiliations, Publication Date, Fulltext, Annex, and References
|
|
672
|
+
- **Clean Formatting**: Human-readable format suitable for documentation and sharing
|
|
673
|
+
- **Preserved Content**: All text content with proper section organization
|
|
674
|
+
- **Reference Formatting**: Bibliographic references in a readable format
|
|
675
|
+
|
|
676
|
+
#### Markdown Structure
|
|
677
|
+
|
|
678
|
+
The generated Markdown follows this structure:
|
|
679
|
+
|
|
680
|
+
```markdown
|
|
681
|
+
# Document Title
|
|
682
|
+
|
|
683
|
+
## Authors
|
|
684
|
+
|
|
685
|
+
- Author Name 1
|
|
686
|
+
- Author Name 2
|
|
687
|
+
|
|
688
|
+
## Affiliations
|
|
689
|
+
|
|
690
|
+
- Affiliation 1
|
|
691
|
+
- Affiliation 2
|
|
692
|
+
|
|
693
|
+
## Publication Date
|
|
694
|
+
|
|
695
|
+
January 1, 2023
|
|
696
|
+
|
|
697
|
+
## Fulltext
|
|
698
|
+
|
|
699
|
+
### Introduction
|
|
700
|
+
|
|
701
|
+
Content of the introduction section...
|
|
702
|
+
|
|
703
|
+
### Methods
|
|
704
|
+
|
|
705
|
+
Content of the methods section...
|
|
706
|
+
|
|
707
|
+
## Annex
|
|
708
|
+
|
|
709
|
+
### Acknowledgements
|
|
710
|
+
|
|
711
|
+
Acknowledgement text...
|
|
712
|
+
|
|
713
|
+
### Competing Interests
|
|
714
|
+
|
|
715
|
+
Competing interests statement...
|
|
716
|
+
|
|
717
|
+
## References
|
|
718
|
+
|
|
719
|
+
**[1]** Paper Title. *Author Name*. *Journal Name* (2023).
|
|
720
|
+
**[2]** Another Paper. *Author et al.*. *Conference* (2022).
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
#### Usage Examples
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
# Generate both TEI and Markdown outputs
|
|
727
|
+
grobid_client --input pdfs/ --output results/ --markdown processFulltextDocument
|
|
728
|
+
|
|
729
|
+
# Markdown output with coordinates and sentence segmentation
|
|
730
|
+
grobid_client --input pdfs/ --output results/ --markdown --teiCoordinates --segmentSentences processFulltextDocument
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
```python
|
|
734
|
+
# Python library usage
|
|
735
|
+
client.process(
|
|
736
|
+
service="processFulltextDocument",
|
|
737
|
+
input_path="/path/to/pdfs",
|
|
738
|
+
output_path="/path/to/output",
|
|
739
|
+
markdown_output=True
|
|
740
|
+
)
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
> [!NOTE]
|
|
744
|
+
> When using `--markdown`, the `--force` flag only checks for existing TEI files. If a TEI file is rewritten (due to `--force`), the corresponding Markdown file is automatically rewritten as well.
|
|
745
|
+
|
|
453
746
|
### Header Document Processing
|
|
747
|
+
|
|
454
748
|
Extracts only document metadata (title, authors, abstract, etc.).
|
|
455
749
|
|
|
456
750
|
```bash
|
|
@@ -458,6 +752,7 @@ grobid_client --input pdfs/ --output headers/ processHeaderDocument
|
|
|
458
752
|
```
|
|
459
753
|
|
|
460
754
|
### Reference Processing
|
|
755
|
+
|
|
461
756
|
Extracts and structures bibliographic references from documents.
|
|
462
757
|
|
|
463
758
|
```bash
|
|
@@ -465,6 +760,7 @@ grobid_client --input pdfs/ --output refs/ processReferences
|
|
|
465
760
|
```
|
|
466
761
|
|
|
467
762
|
### Citation List Processing
|
|
763
|
+
|
|
468
764
|
Parses raw citation strings from text files.
|
|
469
765
|
|
|
470
766
|
```bash
|
|
@@ -507,6 +803,7 @@ pytest -v
|
|
|
507
803
|
### Continuous Integration
|
|
508
804
|
|
|
509
805
|
Tests are automatically run via GitHub Actions on:
|
|
806
|
+
|
|
510
807
|
- Push to main branch
|
|
511
808
|
- Pull requests
|
|
512
809
|
- Multiple Python versions (3.8-3.13)
|
|
@@ -529,7 +826,7 @@ Benchmark results for processing **136 PDFs** (3,443 pages total, ~25 pages per
|
|
|
529
826
|
### Additional Benchmarks
|
|
530
827
|
|
|
531
828
|
- **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
|
|
829
|
+
- **Reference extraction**: 26.9s for 136 PDFs (5.1 PDF/s) with n=10
|
|
533
830
|
- **Citation parsing**: 4.3s for 3,500 citations (814 citations/s) with n=10
|
|
534
831
|
|
|
535
832
|
## 🛠️ Development
|
|
@@ -579,7 +876,8 @@ bump-my-version bump patch
|
|
|
579
876
|
|
|
580
877
|
## 📄 License
|
|
581
878
|
|
|
582
|
-
Distributed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0). See `LICENSE` for more
|
|
879
|
+
Distributed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0). See `LICENSE` for more
|
|
880
|
+
information.
|
|
583
881
|
|
|
584
882
|
## 👥 Authors & Contact
|
|
585
883
|
|