pyBioMedLink for Bio-Medical Term Linking.
Project description
pyBioMedLink
pyBioMedLink is an open-source python library for bio-medical term linking.
Usage
Use Case 1 for BioDomain Linking using Qwen3
corpus = [
"Epigenetic",
"DNA Repair",
"Metal Binding and Homeostasis"
"Synapse",
"Immune System",
"Cell Cycle",
"Lipid Metabolism",
"Vasculature",
]
query = "aging"
linker = Qwen3PromptLinker(
corpus,
model_name="Qwen/Qwen3-0.6B"
)
top_k = 3
predictions = linker.predict_aux(query, top_k)
print(f"Predictions for query '{query}': {predictions}")
# {'labels': ['Cell Cycle', 'DNA Repair', 'Epigenetic'], "thinking_content": ..., "content": ..., "error_msg": ...}
Use Case 2 for IR baselines
from pybiomedlink.linker import BM25Linker
corpus = [
"Hello there good man!",
"It is quite windy in London",
"How is the weather today?"
]
query = "windy London"
bm25_linker = BM25Linker(corpus)
top_k = 2
predictions = bm25_linker.predict(query, top_k)
print(f"Predictions for query '{query}': {predictions}")
# ['It is quite windy in London', 'How is the weather today?']
pred_score_results = bm25_linker.predict_aux(query, top_k)
print(f"Predictions with scores for query '{query}': {pred_score_results}")
# {'labels': ['It is quite windy in London', 'How is the weather today?', 'Hello there good man!'], 'scores': [0.9372947225064051, 0.0, 0.0]}
Supported Models
Zero-shot models:
- BM25Linker: A BM25-based linker
- LevenshteinLinker: A Levenshtein distance-based linker
- TransformerEmbLinker: A Transformer-based embedding linker
- Qwen3PromptLinker: A Qwen3-based prompt linker. Note: can only return a ranked list without scores.
How to run tests
To run the tests, you can use the following command:
uv run python -m pytest -v tests/
uv run python -m pytest -v -s tests/test_Transformer.py
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
pybiomedlink-0.2.0.tar.gz
(13.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybiomedlink-0.2.0.tar.gz.
File metadata
- Download URL: pybiomedlink-0.2.0.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea6603016c71de7a25ee6eb72b391e6c2ec0ee8b7281a097a5c3b5f14aa2023a
|
|
| MD5 |
018a24e4728a6b76291d043344a3c25f
|
|
| BLAKE2b-256 |
25ece5c58145448f268b0b81d703fc44a73526d1ab0ec3584202479d1352083a
|
File details
Details for the file pybiomedlink-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pybiomedlink-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11768a5c397ae3bb03f207b8892f4e6daed8e3e30805fcd197e46c698f77104e
|
|
| MD5 |
7ad6d75fe709503dd569e7de44c4cab6
|
|
| BLAKE2b-256 |
275b53db1ca64989deb42071fc98780e273342be628b7f13598c5679730610ef
|