Defining colors: Displacy entity recognizer #11651
-
|
Hi, Could you please let me know how to define the background and foreground colors when using displacy entity recognizer? I am more interested in using solid colors. Thank you for your reply in advance. Bala |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
|
Hi @balachander1964 , you can override the color via the displaCy API. You need to pass a dictionary (where each key is an entity-type with its corresponding color value) in the However, there's no option to do this for the background color. You might need to use HTML/CSS templates as a workaround. The displaCy templates are made of HTML tags. You can copy what's in |
Beta Was this translation helpful? Give feedback.
-
|
Hi, Got your reply working. I appreciate your quick reply. Thank you very much. Bala |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Please ignore my previous text which I forwarded just few minutes ago. Here is the code enclosed within the markers. |
Beta Was this translation helpful? Give feedback.


Hi @balachander1964 , you can override the color via the displaCy API. You need to pass a dictionary (where each key is an entity-type with its corresponding color value) in the
colorsparameter.However, there's no option to do this for the background color. You might need to use HTML/CSS templates as a workaround. The displaCy templates are made of HTML tags. You can copy what's in
TPL_ENTSandTPL_ENT, then create adivthat sets thebackground-colorto something you like, Afterwards, you can pass it in thetemplateoption of the visualizer.