'Highlight text parts based on labels

thanks to fellow stackoverflowrians I have data labels that I would like to high light in the text:

eg. I have product description

Description: Tampered black round grey/natural swing with yellow load-bearing left hook

Features were extracted as

colors=['black','grey','natural','yellow']
shape = ['round']
direction= ['left']

In Spacy it is possible to highlight the features like this

enter image description here

Is there any possibility to highlight it also like this from the data I have as labels? So that I have labels shown in the text too? I dont know if Spacy is the good tool or any other is better?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source