tuned_lens.plotting.token_formatter#

Contains a class for formatting tokens for display in plots.

Classes

class tuned_lens.plotting.token_formatter.TokenFormatter(ellipsis='…', newline_replacement='\\\\n', newline_token='Ċ', whitespace_token='Ġ', whitespace_replacement='_', max_string_len=7)#

Format tokens for display in a plots.

format(token)#

Format a token for display in a plot.

Return type:

str

pad_token_repr_to_max_len(token_repr)#

Pad a token representation to the max string length.

Return type:

str