Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get_highlighted_tokens
def get_highlighted_tokens(tokens, matrix, model, layer_name, threshold, y_labels):
indices = get_token_indices(model, layer_name, threshold, matrix, y_labels)
ctokens = []
for i, t in enumerate(tokens):
if i in indices.keys():
_color = color(indices[i], threshold=threshold)
ctokens.append(cstr(t, color=_color))
else:
ctokens.append(t)
return html_print(cstr(' '.join(ctokens), color='black') )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.