|
a |
|
b/config.py |
|
|
1 |
entity_to_acronyms = { |
|
|
2 |
'Activity': 'ACT', |
|
|
3 |
'Administration': 'ADM', |
|
|
4 |
'Age': 'AGE', |
|
|
5 |
'Area': 'ARA', |
|
|
6 |
'Biological_attribute': 'BAT', |
|
|
7 |
'Biological_structure': 'BST', |
|
|
8 |
'Clinical_event': 'CLE', |
|
|
9 |
'Color': 'COL', |
|
|
10 |
'Coreference': 'COR', |
|
|
11 |
'Date': 'DAT', |
|
|
12 |
'Detailed_description': 'DET', |
|
|
13 |
'Diagnostic_procedure': 'DIA', |
|
|
14 |
'Disease_disorder': 'DIS', |
|
|
15 |
'Distance': 'DIS', |
|
|
16 |
'Dosage': 'DOS', |
|
|
17 |
'Duration': 'DUR', |
|
|
18 |
'Family_history': 'FAM', |
|
|
19 |
'Frequency': 'FRE', |
|
|
20 |
'Height': 'HEI', |
|
|
21 |
'History': 'HIS', |
|
|
22 |
'Lab_value': 'LAB', |
|
|
23 |
'Mass': 'MAS', |
|
|
24 |
'Medication': 'MED', |
|
|
25 |
'Nonbiological_location': 'NBL', |
|
|
26 |
'Occupation': 'OCC', |
|
|
27 |
'Other_entity': 'OTH', |
|
|
28 |
'Other_event': 'OTE', |
|
|
29 |
'Outcome': 'OUT', |
|
|
30 |
'Personal_background': 'PER', |
|
|
31 |
'Qualitative_concept': 'QUC', |
|
|
32 |
'Quantitative_concept': 'QUC', |
|
|
33 |
'Severity': 'SEV', |
|
|
34 |
'Sex': 'SEX', |
|
|
35 |
'Shape': 'SHA', |
|
|
36 |
'Sign_symptom': 'SIG', |
|
|
37 |
'Subject': 'SUB', |
|
|
38 |
'Texture': 'TEX', |
|
|
39 |
'Therapeutic_procedure': 'THP', |
|
|
40 |
'Time': 'TIM', |
|
|
41 |
'Volume': 'VOL', |
|
|
42 |
'Weight': 'WEI' |
|
|
43 |
} |
|
|
44 |
|
|
|
45 |
index_to_label = {1: 'B-ACT', |
|
|
46 |
2: 'B-ADM', |
|
|
47 |
3: 'B-AGE', |
|
|
48 |
4: 'B-ARA', |
|
|
49 |
5: 'B-BAT', |
|
|
50 |
6: 'B-BST', |
|
|
51 |
7: 'B-CLE', |
|
|
52 |
8: 'B-COL', |
|
|
53 |
9: 'B-COR', |
|
|
54 |
10: 'B-DAT', |
|
|
55 |
11: 'B-DET', |
|
|
56 |
12: 'B-DIA', |
|
|
57 |
13: 'B-DIS', |
|
|
58 |
14: 'B-DOS', |
|
|
59 |
15: 'B-DUR', |
|
|
60 |
16: 'B-FAM', |
|
|
61 |
17: 'B-FRE', |
|
|
62 |
18: 'B-HEI', |
|
|
63 |
19: 'B-HIS', |
|
|
64 |
20: 'B-LAB', |
|
|
65 |
21: 'B-MAS', |
|
|
66 |
22: 'B-MED', |
|
|
67 |
23: 'B-NBL', |
|
|
68 |
24: 'B-OCC', |
|
|
69 |
25: 'B-OTE', |
|
|
70 |
26: 'B-OTH', |
|
|
71 |
27: 'B-OUT', |
|
|
72 |
28: 'B-PER', |
|
|
73 |
29: 'B-QUC', |
|
|
74 |
30: 'B-SEV', |
|
|
75 |
31: 'B-SEX', |
|
|
76 |
32: 'B-SHA', |
|
|
77 |
33: 'B-SIG', |
|
|
78 |
34: 'B-SUB', |
|
|
79 |
35: 'B-TEX', |
|
|
80 |
36: 'B-THP', |
|
|
81 |
37: 'B-TIM', |
|
|
82 |
38: 'B-VOL', |
|
|
83 |
39: 'B-WEI', |
|
|
84 |
40: 'I-ACT', |
|
|
85 |
41: 'I-ADM', |
|
|
86 |
42: 'I-AGE', |
|
|
87 |
43: 'I-ARA', |
|
|
88 |
44: 'I-BAT', |
|
|
89 |
45: 'I-BST', |
|
|
90 |
46: 'I-CLE', |
|
|
91 |
47: 'I-COL', |
|
|
92 |
48: 'I-COR', |
|
|
93 |
49: 'I-DAT', |
|
|
94 |
50: 'I-DET', |
|
|
95 |
51: 'I-DIA', |
|
|
96 |
52: 'I-DIS', |
|
|
97 |
53: 'I-DOS', |
|
|
98 |
54: 'I-DUR', |
|
|
99 |
55: 'I-FAM', |
|
|
100 |
56: 'I-FRE', |
|
|
101 |
57: 'I-HEI', |
|
|
102 |
58: 'I-HIS', |
|
|
103 |
59: 'I-LAB', |
|
|
104 |
60: 'I-MAS', |
|
|
105 |
61: 'I-MED', |
|
|
106 |
62: 'I-NBL', |
|
|
107 |
63: 'I-OCC', |
|
|
108 |
64: 'I-OTE', |
|
|
109 |
65: 'I-OTH', |
|
|
110 |
66: 'I-OUT', |
|
|
111 |
67: 'I-PER', |
|
|
112 |
68: 'I-QUC', |
|
|
113 |
69: 'I-SEV', |
|
|
114 |
70: 'I-SHA', |
|
|
115 |
71: 'I-SIG', |
|
|
116 |
72: 'I-SUB', |
|
|
117 |
73: 'I-TEX', |
|
|
118 |
74: 'I-THP', |
|
|
119 |
75: 'I-TIM', |
|
|
120 |
76: 'I-VOL', |
|
|
121 |
77: 'I-WEI', |
|
|
122 |
78: 'O', |
|
|
123 |
0: '<PAD>'} |
|
|
124 |
|
|
|
125 |
MAX_LENGTH = 100 |
|
|
126 |
|
|
|
127 |
acronyms_to_entities = {v: k for k, v in entity_to_acronyms.items()} |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
models = { |
|
|
131 |
"model_1": { |
|
|
132 |
"path": "../models/model_1.h5", |
|
|
133 |
"title": "Bidirectional LSTM Model with single LSTM layer" |
|
|
134 |
}, |
|
|
135 |
"model_2": { |
|
|
136 |
"path": "../models/model_2.h5", |
|
|
137 |
"title": "Bidirectional LSTM Model with two LSTM layers and one Hidden Dense Layer" |
|
|
138 |
}, |
|
|
139 |
"model_3": { |
|
|
140 |
"path": "../models/model_3.h5", |
|
|
141 |
"title": "Bidirectional LSTM model with BioWordVecEmbedding Layers followed two LSTM layers and one Hidden Dense Layer" |
|
|
142 |
}, |
|
|
143 |
"model_4": { |
|
|
144 |
"path": "../models/model_4.h5", |
|
|
145 |
"title": "Bidirectional LSTM Model with Time Distributed Dense Layers - Single LSTM layer and Two time distributed dense layers" |
|
|
146 |
}, |
|
|
147 |
"model_5": { |
|
|
148 |
"path": "../models/model_5.h5", |
|
|
149 |
"title": "Bidirectional LSTM Model with two LSTM layers and one Hidden Dense Layer" |
|
|
150 |
}, |
|
|
151 |
"model_6": { |
|
|
152 |
"path": "../models/model_6.h5", |
|
|
153 |
"title": "Bidirectional LSTM Time Distirbuted Dense Layers and Convolutional 1D layer" |
|
|
154 |
}, |
|
|
155 |
"model_7": { |
|
|
156 |
"path": "../models/model_7.h5", |
|
|
157 |
"title": "Bidirectional LSTM CRF model with BioWordVecEmbedding Layers followed two LSTM layers, Time Distirbuted Dense Layers and Convolutional 1D layer" |
|
|
158 |
} |
|
|
159 |
} |