udapi.block.write.textmodetreeshtml module

An ASCII pretty printer of colored dependency trees in HTML.

class udapi.block.write.textmodetreeshtml.TextModeTreesHtml(color=True, title='Udapi visualization', zones_in_rows=True, **kwargs)[source]

Bases: TextModeTrees

An ASCII pretty printer of colored dependency trees in HTML.

SYNOPSIS # from command line (visualize CoNLL-U files) udapy write.TextModeTreesHtml < file.conllu > file.html

This block is a subclass of TextModeTrees, see its documentation for more info.

add_node(idx, node)[source]

Render a node with its attributes.

after_process_document(document)[source]

This method is called after each process_document.

before_process_document(document)[source]

Initialize ANSI colors if color is True or ‘auto’.

If color==’auto’, detect if sys.stdout is interactive (terminal, not redirected to a file).

static colorize_attr(attr, value, marked)[source]

Return a string with color markup for a given attr and its value.

colorize_comment(comment)[source]

Return a string with color markup for a given comment.

print_headers(root)[source]

Print sent_id, text and other comments related to the tree.

process_bundle(bundle)[source]

Process a UD bundle