Skip to main content

Chemical Properties Relation Extraction

Project description

CPREx - Chemical Properties Relation Extraction

License python_version

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 pipeline to perform NER and RE.

The pipeline performs the following steps

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 and its extension 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 JDKs from 1.11 to 1.17.

Install via PyPI

You can install CPREx directly with pip:

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.

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 and its extension 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

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

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

cprex install-models

This will install a PubmedBert model finetuned on the NLM-CHEM corpus for extraction of chemical named entities. This model was finetuned by the BioCreative VII track.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cprex-0.3.0.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

cprex-0.3.0-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file cprex-0.3.0.tar.gz.

File metadata

  • Download URL: cprex-0.3.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cprex-0.3.0.tar.gz
Algorithm Hash digest
SHA256 53a4ad9feec2cedd80160319c7be083604fd31c5d3d8753695d427da3a59f1ac
MD5 8c32b879a4f38748727bc448f6e1f758
BLAKE2b-256 c766ca61d1523e6392847b815e382c458fecd0b247abda1ea782e44888973dd8

See more details on using hashes here.

File details

Details for the file cprex-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: cprex-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cprex-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae170a4fca8538dfaa7b02a23cb2aa265f272e25c7190d6669d9acdffed10852
MD5 a9295c72889f00f23853af2d0b3c86d8
BLAKE2b-256 ebcfeb463bbec39f46cfc0ba1f0eb91133094d95d6ab3f2658c6bfcdb36113e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page