Dagobert42's picture
edit gitignore
ec77f50
raw
history blame
812 Bytes
colors = {
'GeneOrGeneProduct': '#aad4aa', # Pastel green
'DiseaseOrPhenotypicFeature': '#f8b400', # Pastel orange
'ChemicalEntity': '#a4c2f4', # Pastel blue
'OrganismTaxon': '#ffb6c1', # Pastel pink
'SequenceVariant': '#e2b0ff', # Pastel purple
'CellLine': '#ffcc99' # Pastel peach
}
output = []
i = 0
for p in predictions:
if sentence[i:p['start']] != '':
output.append(sentence[i:p['start']])
output.append(
(sentence[p['start']:p['end']], p['entity_group'], colors[p['entity_group']])
if p['entity_group'] != 'null'
else sentence[p['start']:p['end']]
)
i = p['end']
if sentence[p['end']:]:
output.append(sentence[p['end']:])
return output