order label assignment and align them with previously used labels
Closed this issue · 1 comments
davidberenstein1957 commented
HI @kevin91nl, this is awesome and exactly what I was looking for, however, I get some minor issues with label colors. If I pre-assign annotations without a color, they all get the colour blue, and if I later assign the same label, it gets the colour red.
kevin91nl commented
Thank you @davidberenstein1957 for your feedback!
From version 0.0.9, you can use the following to specify the color labels:
result = text_highlighter(
text="Cats and dogs in the Netherlands are awesome!",
labels=[
("ANIMAL", "yellow"),
("LOCATION", "green")
],
annotations=[
{
"start": 0,
"end": 4,
"text": "and",
"tag": "ANIMAL",
"color": "yellow"
}
]
)
Here, all ANIMAL
tags will become yellow and all LOCATION
tags will become green.