Downloads · 30 days
0
0% of all-time downloads
helpmefindaname/flair-eml-biobert-bc2gn-gene
flair-eml-biobert-bc2gn-gene is a machine learning model from helpmefindaname. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for flair.
Biomedical Entity Mention Linking for gene
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
665
Public
Repo size
2.2 GB
Likes
0
Public
Click a slice to open those files.
.bin2.2 GB · 100%
From the Hugging Face model README
Biomedical Entity Mention Linking for gene
Requires:
pip install flair or pip install git+https://github.com/flairNLP/flair.git)from flair.data import Sentence
from flair.models import Classifier, EntityMentionLinker
sentence = Sentence("Behavioral abnormalities in the Fmr1 KO2 Mouse Model of Fragile X Syndrome")
# load hunflair to detect the entity mentions we want to link.
tagger = Classifier.load("hunflair")
tagger.predict(sentence)
# load the linker and dictionary
linker = EntityMentionLinker.load("helpmefindaname/flair-eml-biobert-bc2gn-gene")
dictionary = linker.dictionary
# find then candidates for the mentions
linker.predict(sentence)
# print the results for each entity mention:
for span in sentence.get_spans(linker.entity_label_type):
print(f"Span: {span.text}")
for candidate_label in span.get_labels(linker.label_type):
candidate = dictionary[candidate_label.value]
print(f"Candidate: {candidate.concept_name}")
As an alternative to downloading the already precomputed model (much storage). You can also build the model and compute the embeddings for the dataset using:
linker = EntityMentionLinker.build("dmis-lab/biosyn-biobert-bc2gn", "gene", dictionary_name_or_path="ncbi-gene", hybrid_search=False, entity_type="gene-eml")
This will reduce the download requirements, at the cost of computation.
This EntityMentionLinker uses https://huggingface.co/dmis-lab/biosyn-biobert-bc2gn as embeddings for linking mentions to candidates.