A relation extraction toolkit for biomedical text mining
Project description
Kindred
Kindred is a Python3 package for relation extraction in biomedical texts. Given some training data, it can build a model to identify relations between entities (e.g. drugs, genes, etc) in a sentence.
Installation
You can install "kindred" via pip from PyPI
pip install kindred
Kindred relies on the Spacy toolkit for parsing. After installing kindred (which also installs spacy), you will need to install a Spacy language model. For instance, the command below installs the English language model::
python -m spacy download en_core_web_sm
Usage
Check out the tutorial that goes through a simple use case of extracting capital cities from text. More details and the full documentation can be found at readthedocs.
BioNLP Shared Task Example
import kindred
# Load the SeeDev corpus
trainCorpus = kindred.bionlpst.load('2016-SeeDev-binary-train')
devCorpus = kindred.bionlpst.load('2016-SeeDev-binary-dev')
# Create a copy of the dev corpus to make predictions on
predictionCorpus = devCorpus.clone()
predictionCorpus.removeRelations()
# Create a relation classifier, train it and make predictions
classifier = kindred.RelationClassifier()
classifier.train(trainCorpus)
classifier.predict(predictionCorpus)
# Get the F1 score of the predicted relations
f1score = kindred.evaluate(devCorpus, predictionCorpus, metric='f1score')
PubAnnotation Example
corpus = kindred.pubannotation.load('bionlp-st-gro-2013-development')
PubTator Example
corpus = kindred.pubtator.load([19894120,19894121])
Input Formats
Kindred can load several formats, including BioNLP Shared Task, JSON, BioC XML and a simple tag format. Check out the file format documentation for example data and code.
Citing
It would be wonderful if you could cite the associated paper for this package if used in any academic research.
@article{lever2017painless,
title={Painless {R}elation {E}xtraction with {K}indred},
author={Lever, Jake and Jones, Steven},
journal={BioNLP 2017},
pages={176--183},
year={2017}
}
Contributing
Contributions are very welcome.
License
Distributed under the terms of the MIT license, "kindred" is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file kindred-2.8.3.tar.gz
.
File metadata
- Download URL: kindred-2.8.3.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bfde83a6fb0a15252a0857127206e96834d64d26382bfd550cd235369aca2a9 |
|
MD5 | 309b1929a1cb61dcde150c98eb0ba30f |
|
BLAKE2b-256 | 19530aa029ba59db0badaff957f682ad4569f742fed6d0e8c097d8c5a0e2d395 |