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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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