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).
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
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_publicGenerate 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.
Generate the CoDiet Silver corpus:
generate_codiet_silver(
'./CoDiet-Bronze-Silver-Electrum'
)The results will be stored in CoDiet_Silver_bioc.
Generate the CoDiet Electrum corpus:
generate_codiet_electrum(
'./CoDiet-Bronze-Silver-Electrum'
)The results will be stored in CoDiet_Electrum_bioc.
Generate the CoDiet Gold Private corpus:
generate_codiet_gold_private(
'./CoDiet-Gold-private'
)The results will be stored in CoDiet_Gold_private_bioc.
Generate the CoDiet Gold Public corpus:
generate_codiet_gold_public(
'./CoDiet-Gold-public'
)The results will be stored in CoDiet_Gold_public_bioc.
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_publicEach annotation function takes two arguments:
- The path to the generated BioC corpus.
- The directory where the annotated files from Zenodo are stored.
annotate_codiet_bronze(
'./CoDiet_Bronze_bioc/',
'./CoDiet-Bronze/'
)The results will be stored in CoDiet_Bronze_annotated.
annotate_codiet_silver(
'./CoDiet_Silver_bioc/',
'./CoDiet-Silver/'
)The results will be stored in CoDiet_Silver_annotated.
annotate_codiet_electrum(
'./CoDiet_Electrum_bioc/',
'./CoDiet-Electrum/'
)The results will be stored in CoDiet_Electrum_annotated.
annotate_codiet_gold_public(
'./CoDiet_Gold_public_bioc/',
'./CoDiet-Gold-public/'
)The results will be stored in CoDiet_Gold_public_annotated.
A typical workflow consists of two steps:
- Generate the corpus from the XML files.
- 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.
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.