segram.utils.colors module

Printing methods for visualization.

segram.utils.colors.color_role(text: str, role: str | Role | None = None, *, color: bool = True, cmap: str | None = None, **kwds: Any) str[source]

Color token based on its syntactic role.

Parameters:
  • tok – Token as string.

  • role – Phrasal role of tok. If it is not recognized then no coloring is done.

  • color – Should coloring be done.

  • cmap – Name of the colormap to use. If None then default colormap is used.

  • **kwds – Passed to color().