Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOI:10.1101/2021.01.08.425887 DOI:10.5281/zenodo.22097875 DOI:10.5281/zenodo.22097879 DOI:10.5281/zenodo.22097881 Codabench Archived Code CoDiet

🍎 CoDietZenodo

Python package for generating and annotating the CoDiet corpus datasets.

This repository provides functions to generate multiple versions of the CoDiet corpus from PMC Open Access XML files and to create annotated BioC corpora.

The package supports five corpus versions:

  • CoDiet Bronze
  • CoDiet Silver
  • CoDiet Electrum
  • CoDiet Gold Private
  • CoDiet Gold Public

The project follows the CoDiet corpus generation and annotation workflow developed in the broader CoDiet project. The related CoDietCorpus repository contains the code used for the creation and annotation of the CoDiet (Bronze and Silver).


⚙️ Installation

CoDietZenodo has a number of dependencies on other Python packages; it is recommended to install it in an isolated environment.

git clone https://github.com/omicsNLP/CoDietZenodo.git

pip install ./CoDietZenodo


🧾 Generating the CoDiet corpora

The package provides separate functions for generating each version of the CoDiet corpus.

from CoDietZenodo import generate_codiet_bronze
from CoDietZenodo import generate_codiet_silver
from CoDietZenodo import generate_codiet_electrum
from CoDietZenodo import generate_codiet_gold_private
from CoDietZenodo import generate_codiet_gold_public

CoDiet Bronze

Generate the CoDiet Bronze corpus from the Zenodo XML files:

generate_codiet_bronze(
    './CoDiet-Bronze-Silver-Electrum'
)

The results will be stored in CoDiet_Bronze_bioc.

CoDiet Silver

Generate the CoDiet Silver corpus:

generate_codiet_silver(
    './CoDiet-Bronze-Silver-Electrum'
)

The results will be stored in CoDiet_Silver_bioc.

CoDiet Electrum

Generate the CoDiet Electrum corpus:

generate_codiet_electrum(
    './CoDiet-Bronze-Silver-Electrum'
)

The results will be stored in CoDiet_Electrum_bioc.

CoDiet Gold Private

Generate the CoDiet Gold Private corpus:

generate_codiet_gold_private(
    './CoDiet-Gold-private'
)

The results will be stored in CoDiet_Gold_private_bioc.

CoDiet Gold Public

Generate the CoDiet Gold Public corpus:

generate_codiet_gold_public(
    './CoDiet-Gold-public'
)

The results will be stored in CoDiet_Gold_public_bioc.


🤖 Annotating the CoDiet corpora

The package also provides functions for generating annotated versions of the CoDiet datasets.

from CoDietZenodo import annotate_codiet_bronze
from CoDietZenodo import annotate_codiet_silver
from CoDietZenodo import annotate_codiet_electrum
from CoDietZenodo import annotate_codiet_gold_public

Each annotation function takes two arguments:

  1. The path to the generated BioC corpus.
  2. The directory where the annotated files from Zenodo are stored.

Annotate CoDiet Bronze

annotate_codiet_bronze(
    './CoDiet_Bronze_bioc/',
    './CoDiet-Bronze/'
)

The results will be stored in CoDiet_Bronze_annotated.

Annotate CoDiet Silver

annotate_codiet_silver(
    './CoDiet_Silver_bioc/',
    './CoDiet-Silver/'
)

The results will be stored in CoDiet_Silver_annotated.

Annotate CoDiet Electrum

annotate_codiet_electrum(
    './CoDiet_Electrum_bioc/',
    './CoDiet-Electrum/'
)

The results will be stored in CoDiet_Electrum_annotated.

Annotate CoDiet Gold Public

annotate_codiet_gold_public(
    './CoDiet_Gold_public_bioc/',
    './CoDiet-Gold-public/'
)

The results will be stored in CoDiet_Gold_public_annotated.


🧩 Complete workflow

A typical workflow consists of two steps:

  1. Generate the corpus from the XML files.
  2. Create annotated files from the generated BioC corpus.

For example, to generate and annotate the CoDiet Bronze corpus:

from CoDietZenodo import generate_codiet_bronze
from CoDietZenodo import annotate_codiet_bronze


# Generate the BioC corpus
generate_codiet_bronze(
    './CoDiet-Bronze-Silver-Electrum'
)


# Generate annotation-only files
annotate_codiet_bronze(
    './CoDiet_Bronze_bioc/',
    './CoDiet-Bronze/'
)

The same workflow can be applied to the other available corpus versions.


⚠️ Important - Please Read!

Published literature can be subject to copyright with restrictions on redistribution. Users need to be mindful of the data storage requirements and how the derived products are presented and shared. Many publishers provide guidance on the use of content for redistribution and use in research.


👥 Code Contributors


👉 Antoine
  
👉 Joram


About

This repository contains the code to retrieve the annotated CoDiet Corpus

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages