cprex


Namecprex JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/jonasrenault/cprex#readme
SummaryChemical Properties Relation Extraction
upload_time2024-03-08 16:47:08
maintainer
docs_urlNone
authorJonas Renault
requires_python>=3.11,<4.0
licenseMIT
keywords pubchem crawler chemistry machine-learning relation-extraction named-entity-extraction deep-learning transformers spacy scientific-articles
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CPREx - Chemical Properties Relation Extraction

[![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)
![python_version](https://img.shields.io/badge/Python-%3E=3.11-blue)

CPREx is an end to end tool for Named Entity Recognition (NER) and Relation Extraction (RE) specifically designed for chemical compounds and their properties. The goal of the tool is to identify, extract and link chemical compounds and their properties from scientific literature. For ease of use, CPREx provides a custom [spacy](https://spacy.io/) pipeline to perform NER and RE.

The pipeline performs the following steps

```mermaid
flowchart LR
    crawler("`**crawler**
    fetch PDF articles
    from online archives`")
    parser("`**parser**
    Extract text
    from PDF`")
    crawler --> parser
    parser --> ner
    ner("`**NER**
    extract named
    entities`")
    ner --> chem["`**Chem**
    *1,3,5-Triazine*
    *Zinc bromide*
    *C₃H₄N₂*`"] --> rel
    ner --> prop["`**Property**
    *fusion enthalpy*
    *Tc*`"] --> rel
    ner --> quantity["`**Value**
    *169°C*
    *21.49 kJ/mol*`"] --> rel
    rel("`**Relation Extraction**
    link entities`")
    rel --> res
    res("`**(Chem, Property, Value)**
    *2,2'-Binaphthalene, ΔHfus, 38.9 kJ/mol*`")
```

## Installation

CPREx works with a recent version of python (**>=python 3.11**). Make sure to install CPREx in a virtual environment of your choice.

CPREx depends on [GROBID](https://github.com/kermitt2/grobid) and its extension [grobid-quantities](https://github.com/lfoppiano/grobid-quantities) for parsing PDF documents and extracting quantities from their text. In order to install and run GROBID, a JDK must also be installed on your machine. [GROBID currently supports](https://grobid.readthedocs.io/en/latest/Install-Grobid/) JDKs from **1.11 to 1.17**.

### Install via PyPI

You can install CPREx directly with pip:

```console
pip install cprex
```

### Install from github

This installation is recommended for users who want to customize the pipeline or train some models on their own dataset.

Clone the repository and install the project in your python environment.

```console
git clone git@github.com:jonasrenault/cprex.git
cd cprex
pip install --editable .
```

Any modifications you make to the cprex codebase will be immediatly reflected thanks to the `--editable` option.

### Install grobid and models

#### Installing and running grobid

CPREx depends on [GROBID](https://github.com/kermitt2/grobid) and its extension [grobid-quantities](https://github.com/lfoppiano/grobid-quantities) for parsing PDF documents and extracting quantities from their text. For convenience, CPREx provides a command line interface (CLI) to install grobid and start a grobid server.

Run

```console
cprex install-grobid
```

to install a grobid server and the grobid-quantities extension (by default, grobid and models required by CPREx are installed in a `.cprex` directory in your home directory).

Run

```console
cprex start-grobid
```

to start a grobid server and enable parsing of PDF documents from CPREx.

#### Installing NER et REL models

To perform Named Entity Recognition (NER) of chemical compounds and Relation Extraction (RE), CPREx requires some pretrained models. These models can be installed by running

```console
cprex install-models
```

This will install a [PubmedBert model](https://ftp.ncbi.nlm.nih.gov/pub/lu/BC7-NLM-Chem-track/) finetuned on the NLM-CHEM corpus for extraction of chemical named entities. This model was finetuned by the [BioCreative VII track](https://biocreative.bioinformatics.udel.edu/tasks/biocreative-vii/track-2/).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jonasrenault/cprex#readme",
    "name": "cprex",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "pubchem,crawler,chemistry,machine-learning,relation-extraction,named-entity-extraction,deep-learning,transformers,spacy,scientific-articles",
    "author": "Jonas Renault",
    "author_email": "jonasrenault@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c7/66/ca61d1523e6392847b815e382c458fecd0b247abda1ea782e44888973dd8/cprex-0.3.0.tar.gz",
    "platform": null,
    "description": "# CPREx - Chemical Properties Relation Extraction\n\n[![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)\n![python_version](https://img.shields.io/badge/Python-%3E=3.11-blue)\n\nCPREx is an end to end tool for Named Entity Recognition (NER) and Relation Extraction (RE) specifically designed for chemical compounds and their properties. The goal of the tool is to identify, extract and link chemical compounds and their properties from scientific literature. For ease of use, CPREx provides a custom [spacy](https://spacy.io/) pipeline to perform NER and RE.\n\nThe pipeline performs the following steps\n\n```mermaid\nflowchart LR\n    crawler(\"`**crawler**\n    fetch PDF articles\n    from online archives`\")\n    parser(\"`**parser**\n    Extract text\n    from PDF`\")\n    crawler --> parser\n    parser --> ner\n    ner(\"`**NER**\n    extract named\n    entities`\")\n    ner --> chem[\"`**Chem**\n    *1,3,5-Triazine*\n    *Zinc bromide*\n    *C\u2083H\u2084N\u2082*`\"] --> rel\n    ner --> prop[\"`**Property**\n    *fusion enthalpy*\n    *Tc*`\"] --> rel\n    ner --> quantity[\"`**Value**\n    *169\u00b0C*\n    *21.49 kJ/mol*`\"] --> rel\n    rel(\"`**Relation Extraction**\n    link entities`\")\n    rel --> res\n    res(\"`**(Chem, Property, Value)**\n    *2,2'-Binaphthalene, \u0394Hfus, 38.9 kJ/mol*`\")\n```\n\n## Installation\n\nCPREx works with a recent version of python (**>=python 3.11**). Make sure to install CPREx in a virtual environment of your choice.\n\nCPREx depends on [GROBID](https://github.com/kermitt2/grobid) and its extension [grobid-quantities](https://github.com/lfoppiano/grobid-quantities) for parsing PDF documents and extracting quantities from their text. In order to install and run GROBID, a JDK must also be installed on your machine. [GROBID currently supports](https://grobid.readthedocs.io/en/latest/Install-Grobid/) JDKs from **1.11 to 1.17**.\n\n### Install via PyPI\n\nYou can install CPREx directly with pip:\n\n```console\npip install cprex\n```\n\n### Install from github\n\nThis installation is recommended for users who want to customize the pipeline or train some models on their own dataset.\n\nClone the repository and install the project in your python environment.\n\n```console\ngit clone git@github.com:jonasrenault/cprex.git\ncd cprex\npip install --editable .\n```\n\nAny modifications you make to the cprex codebase will be immediatly reflected thanks to the `--editable` option.\n\n### Install grobid and models\n\n#### Installing and running grobid\n\nCPREx depends on [GROBID](https://github.com/kermitt2/grobid) and its extension [grobid-quantities](https://github.com/lfoppiano/grobid-quantities) for parsing PDF documents and extracting quantities from their text. For convenience, CPREx provides a command line interface (CLI) to install grobid and start a grobid server.\n\nRun\n\n```console\ncprex install-grobid\n```\n\nto install a grobid server and the grobid-quantities extension (by default, grobid and models required by CPREx are installed in a `.cprex` directory in your home directory).\n\nRun\n\n```console\ncprex start-grobid\n```\n\nto start a grobid server and enable parsing of PDF documents from CPREx.\n\n#### Installing NER et REL models\n\nTo perform Named Entity Recognition (NER) of chemical compounds and Relation Extraction (RE), CPREx requires some pretrained models. These models can be installed by running\n\n```console\ncprex install-models\n```\n\nThis will install a [PubmedBert model](https://ftp.ncbi.nlm.nih.gov/pub/lu/BC7-NLM-Chem-track/) finetuned on the NLM-CHEM corpus for extraction of chemical named entities. This model was finetuned by the [BioCreative VII track](https://biocreative.bioinformatics.udel.edu/tasks/biocreative-vii/track-2/).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Chemical Properties Relation Extraction",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/jonasrenault/cprex#readme",
        "Repository": "https://github.com/jonasrenault/cprex"
    },
    "split_keywords": [
        "pubchem",
        "crawler",
        "chemistry",
        "machine-learning",
        "relation-extraction",
        "named-entity-extraction",
        "deep-learning",
        "transformers",
        "spacy",
        "scientific-articles"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebcfeb463bbec39f46cfc0ba1f0eb91133094d95d6ab3f2658c6bfcdb36113e1",
                "md5": "a9295c72889f00f23853af2d0b3c86d8",
                "sha256": "ae170a4fca8538dfaa7b02a23cb2aa265f272e25c7190d6669d9acdffed10852"
            },
            "downloads": -1,
            "filename": "cprex-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9295c72889f00f23853af2d0b3c86d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 36788,
            "upload_time": "2024-03-08T16:47:07",
            "upload_time_iso_8601": "2024-03-08T16:47:07.509538Z",
            "url": "https://files.pythonhosted.org/packages/eb/cf/eb463bbec39f46cfc0ba1f0eb91133094d95d6ab3f2658c6bfcdb36113e1/cprex-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c766ca61d1523e6392847b815e382c458fecd0b247abda1ea782e44888973dd8",
                "md5": "8c32b879a4f38748727bc448f6e1f758",
                "sha256": "53a4ad9feec2cedd80160319c7be083604fd31c5d3d8753695d427da3a59f1ac"
            },
            "downloads": -1,
            "filename": "cprex-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8c32b879a4f38748727bc448f6e1f758",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 30783,
            "upload_time": "2024-03-08T16:47:08",
            "upload_time_iso_8601": "2024-03-08T16:47:08.497832Z",
            "url": "https://files.pythonhosted.org/packages/c7/66/ca61d1523e6392847b815e382c458fecd0b247abda1ea782e44888973dd8/cprex-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-08 16:47:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jonasrenault",
    "github_project": "cprex#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cprex"
}
        
Elapsed time: 0.18814s