wbi-sg commited on
Commit
1a0b801
1 Parent(s): c4bfa00

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +53 -0
  2. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - flair
4
+ - entity-mention-linker
5
+ ---
6
+
7
+ ## biosyn-sapbert-bc5cdr-disease
8
+
9
+ Biomedical Entity Mention Linking for disease:
10
+
11
+ - Model: [dmis-lab/biosyn-sapbert-bc5cdr-disease](https://huggingface.co/dmis-lab/biosyn-sapbert-bc5cdr-disease)
12
+ - Dictionary: [CTD Diseases](https://ctdbase.org/voc.go?type=disease) (See License)
13
+
14
+ ### Demo: How to use in Flair
15
+
16
+ Requires:
17
+
18
+ - **[Flair](https://github.com/flairNLP/flair/)>=0.14.0** (`pip install flair` or `pip install git+https://github.com/flairNLP/flair.git`)
19
+
20
+ ```python
21
+ from flair.data import Sentence
22
+ from flair.models import Classifier, EntityMentionLinker
23
+ from flair.tokenization import SciSpacyTokenizer
24
+
25
+ sentence = Sentence(
26
+ "The mutation in the ABCD1 gene causes X-linked adrenoleukodystrophy, "
27
+ "a neurodegenerative disease, which is exacerbated by exposure to high "
28
+ "levels of mercury in dolphin populations.",
29
+ use_tokenizer=SciSpacyTokenizer()
30
+ )
31
+
32
+ # load hunflair to detect the entity mentions we want to link.
33
+ tagger = Classifier.load("hunflair-disease")
34
+ tagger.predict(sentence)
35
+
36
+ # load the linker and dictionary
37
+ linker = EntityMentionLinker.load("disease-linker")
38
+ linker.predict(sentence)
39
+
40
+ # print the results for each entity mention:
41
+ for span in sentence.get_spans(tagger.label_type):
42
+ for link in span.get_labels(linker.label_type):
43
+ print(f"{span.text} -> {link.value}")
44
+ ```
45
+
46
+ As an alternative to downloading the already precomputed model (much storage). You can also build the model
47
+ and compute the embeddings for the dataset using:
48
+
49
+ ```python
50
+ linker = EntityMentionLinker.build("dmis-lab/biosyn-sapbert-bc5cdr-disease", dictionary_name_or_path="ctd-diseases", hybrid_search=True)
51
+ ```
52
+
53
+ This will reduce the download requirements, at the cost of computation.
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bf6ddd1d75ee729c324f87cad1df908fb9f407abc894239230a2150328298f9
3
+ size 1161161651