[![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)
![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-blue)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![License MIT](https://img.shields.io/github/license/ds4sd/deepsearch-toolkit)](https://opensource.org/licenses/MIT)
# Docling Core
Docling Core is a library that defines the data types in [Docling](https://ds4sd.github.io), leveraging pydantic models.
## Installation
Using [Poetry](https://python-poetry.org), create and activate a virtual environment.
```
poetry shell
```
Install the defined dependencies of the project.
```
poetry install
```
Test the installation running the pytest suite.
```
poetry run pytest test
```
## Basic Usage
- You can validate your JSON objects using the pydantic class definition.
```py
from docling_core.types import Document
data_dict = {...} # here the object you want to validate, as a dictionary
Document.model_validate(data_dict)
data_str = {...} # here the object as a JSON string
Document.model_validate_json(data_str)
```
- You can generate the JSON schema of a model with the script `ds_generate_jsonschema`.
```py
# for the `Document` type
ds_generate_jsonschema Document
# for the use `Record` type
ds_generate_jsonschema Record
```
## Documentation
Docling supports 3 main data types:
- **Document** for publications like books, articles, reports, or patents. When Docling converts an unstructured PDF document, the generated JSON follows this schema.
The Document type also models the metadata that may be attached to the converted document.
Check [Document](docs/Document.md) for the full JSON schema.
- **Record** for structured database records, centered on an entity or _subject_ that is provided with a list of attributes.
Related to records, the statements can represent annotations on text by Natural Language Processing (NLP) tools.
Check [Record](docs/Record.md) for the full JSON schema.
- **Generic** for any data representation, ensuring minimal configuration and maximum flexibility.
Check [Generic](docs/Generic.md) for the full JSON schema.
The data schemas are defined using [pydantic](https://pydantic-docs.helpmanual.io/) models, which provide built-in processes to support the creation of data that adhere to those models.
## Contributing
Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
## References
If you use `Docling Core` in your projects, please consider citing the following:
```bib
@software{Docling,
author = {Deep Search Team},
month = {7},
title = {{Docling}},
url = {https://github.com/DS4SD/docling},
version = {main},
year = {2024}
}
```
## License
The `Docling Core` codebase is under MIT license.
For individual model usage, please refer to the model licenses found in the original packages.
Raw data
{
"_id": null,
"home_page": "https://ds4sd.github.io/",
"name": "docling_core",
"maintainer": "Cesar Berrospi Ramis",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": "ceb@zurich.ibm.com",
"keywords": "docling, discovery, etl, information retrieval, analytics, database, database schema, schema, JSON",
"author": "Cesar Berrospi Ramis",
"author_email": "ceb@zurich.ibm.com",
"download_url": "https://files.pythonhosted.org/packages/b9/14/e6416bfe4d32f24cee0976565a1f50fe9f893e9298fa07074944501f9572/docling_core-0.1.0.tar.gz",
"platform": null,
"description": "[![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)\n![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-blue)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![License MIT](https://img.shields.io/github/license/ds4sd/deepsearch-toolkit)](https://opensource.org/licenses/MIT)\n\n# Docling Core\n\nDocling Core is a library that defines the data types in [Docling](https://ds4sd.github.io), leveraging pydantic models.\n\n## Installation\n\nUsing [Poetry](https://python-poetry.org), create and activate a virtual environment.\n\n```\npoetry shell\n```\n\nInstall the defined dependencies of the project.\n\n```\npoetry install\n```\n\nTest the installation running the pytest suite.\n\n```\npoetry run pytest test\n```\n\n## Basic Usage\n\n- You can validate your JSON objects using the pydantic class definition.\n\n ```py\n from docling_core.types import Document\n\n data_dict = {...} # here the object you want to validate, as a dictionary\n Document.model_validate(data_dict)\n\n data_str = {...} # here the object as a JSON string\n Document.model_validate_json(data_str)\n ```\n\n- You can generate the JSON schema of a model with the script `ds_generate_jsonschema`.\n\n ```py\n # for the `Document` type\n ds_generate_jsonschema Document\n\n # for the use `Record` type\n ds_generate_jsonschema Record\n ```\n\n## Documentation\n\nDocling supports 3 main data types:\n\n- **Document** for publications like books, articles, reports, or patents. When Docling converts an unstructured PDF document, the generated JSON follows this schema.\n The Document type also models the metadata that may be attached to the converted document.\n Check [Document](docs/Document.md) for the full JSON schema. \n- **Record** for structured database records, centered on an entity or _subject_ that is provided with a list of attributes.\n Related to records, the statements can represent annotations on text by Natural Language Processing (NLP) tools.\n Check [Record](docs/Record.md) for the full JSON schema. \n- **Generic** for any data representation, ensuring minimal configuration and maximum flexibility.\n Check [Generic](docs/Generic.md) for the full JSON schema. \n\nThe data schemas are defined using [pydantic](https://pydantic-docs.helpmanual.io/) models, which provide built-in processes to support the creation of data that adhere to those models.\n\n## Contributing\n\nPlease read [Contributing to Docling Core](./CONTRIBUTING.md) for details.\n\n## References\n\nIf you use `Docling Core` in your projects, please consider citing the following:\n\n```bib\n@software{Docling,\nauthor = {Deep Search Team},\nmonth = {7},\ntitle = {{Docling}},\nurl = {https://github.com/DS4SD/docling},\nversion = {main},\nyear = {2024}\n}\n```\n\n## License\n\nThe `Docling Core` codebase is under MIT license.\nFor individual model usage, please refer to the model licenses found in the original packages.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python library to define and validate data types in Docling.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://ds4sd.github.io/",
"Repository": "https://github.com/DS4SD/docling-core"
},
"split_keywords": [
"docling",
" discovery",
" etl",
" information retrieval",
" analytics",
" database",
" database schema",
" schema",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9c14e623921dea77b86e647dd17c3f1ca9c4d10aadef2f30df7c49689366aa1b",
"md5": "a9ca52deb494db2623205b1f3a194941",
"sha256": "c0adca943bc14e98680b7399538f5906ee5350510cd3a5b324a9659ad875cf51"
},
"downloads": -1,
"filename": "docling_core-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a9ca52deb494db2623205b1f3a194941",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 45784,
"upload_time": "2024-07-12T15:36:14",
"upload_time_iso_8601": "2024-07-12T15:36:14.957415Z",
"url": "https://files.pythonhosted.org/packages/9c/14/e623921dea77b86e647dd17c3f1ca9c4d10aadef2f30df7c49689366aa1b/docling_core-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b914e6416bfe4d32f24cee0976565a1f50fe9f893e9298fa07074944501f9572",
"md5": "ba2f4383170340d563ec66bc8af54ae5",
"sha256": "5fdc36b9a71e56cd6e9001f475f89ed829afb8402d905c8f7f633238f34dcb5d"
},
"downloads": -1,
"filename": "docling_core-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ba2f4383170340d563ec66bc8af54ae5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 31571,
"upload_time": "2024-07-12T15:36:16",
"upload_time_iso_8601": "2024-07-12T15:36:16.934008Z",
"url": "https://files.pythonhosted.org/packages/b9/14/e6416bfe4d32f24cee0976565a1f50fe9f893e9298fa07074944501f9572/docling_core-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-12 15:36:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DS4SD",
"github_project": "docling-core",
"github_not_found": true,
"lcname": "docling_core"
}