KeyCARE ![Logo](www/keyCARE_smalllogo.png)
A framework for biomedical Keyword Extraction, term Categorization, and semantic Relation.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
- About the Project
- Getting Started
2.1. Installation
2.2. Usage - Contributing
- License
- References
1. About The Project
Back to ToC
KeyBERT provides a common interface for extracting, categorizing and associating terms extracted from a text:
- Keywords extraction: KeyCARE implements several unsupervised term extraction techniques such as YAKE, RAKE, TextRank or KeyBERT to automatically extract key terms from a text.
- Term categorization: KeyCARE allows the application of term clustering techniques to group similar terms, as well as the training and application of supervised techniques to classify keywords into predefined categories, including SetFit.
- Semantic relation classification: Beyond the identification and categorization of terms, the library supports the use of neural classification models, such as the Transformer's AutoModelForSequenceClassification, to extract the semantic relation between two terms by means of EXACT, BROAD, NARROW and NO_RELATION relationships, which allows interconnecting the extracted terms and can be used for terminological enrichment, among other tasks.
2. Getting Started
Back to ToC
2.1. Installation
Installation can be done using pypi:
pip install keycare
You might also need to install spacy's es_core_news_sm:
python3 -m spacy download es_core_news_sm
2.2. Usage
The library is built on 3 main processes: keyword extraction, term categorization and relations extraction. The two first processes have been implemented within a same pipeline in the class TermExtractor
, which automatically extracts classified keywords frim pieces of text. The relations extraction process among term pairs or groups of terms is implemented in the other main class, RelExtractor
.
For the use of TermExtractor with default parameters, use the following code:
from keycare.TermExtractor import TermExtractor
extractor = TermExtractor()
extractor("...")
extractor.keywords
This code calls TermExtractor with default parameters on a piece of text and returns the extracted keywords with their assigned class.
For the use of RelExtractor with default parameters, use the following code:
from keycare.RelExtractor import RelExtractor
relextractor = RelExtractor()
relextractor("...", "...")
relextractor.relations
This code calls RelExtractor with default parameters on pairs of terms and returns the existing relation among them.
For further information on the functioning of the library and the available parameters refer to the tutorials in the nbs folder.
3. Contributing
Back to ToC
This library has been developed with Python 3.10.12
Any contributions you make are greatly appreciated. For contributing:
-
Fork/Clone the Project in your system
git clone https://github.com/nlp4bia-bsc/keycare.git
-
Create a new virtual environment
python3 -m venv .env_keycare
-
Activate the new environment
source .env_keycare/bin/activate
-
Install the requirements
pip install -r requirements.txt
-
Create your Feature Branch (git checkout -b feature/AmazingFeature
)
-
Update requirements file (pip freeze > requirements.txt
)
-
Commit your Changes (git commit -m 'Add some AmazingFeature'
)
-
Push to the Branch (git push origin feature/AmazingFeature
)
-
Open a Pull Request from github.
Follow this tutorial to create a branch.
4. License
Back to ToC
Apache License, Version 2.0
5. References
Back to ToC
A paper on the library will soon be published. Please cite if you use the library in scientific works.