Description Usage Arguments Value Examples
This is a convenience wrapper for tag_tokens() that can be used if tokens only need to be colored.
1 2 3 4 5 6 7 8 9 |
tokens |
A character vector of tokens |
value |
Either a logical vector or a numeric vector with values between 0 and 1. If a logical vector is used, then tokens with TRUE will be highlighted (with the color specified in pos_col). If a numeric vector is used, the value determines the alpha (transparency), with 0 being fully transparent and 1 being fully colored. |
class |
Optionally, a character vector of the class to add to the span tags. If NA no class is added |
col |
The color used to highlight |
unfold |
Either a character vector or a named list of vectors of the same length as tokens. If given, all tokens with a tag can be clicked on to unfold the given text. If a list of vectors is given,
the values of the columns are concatenated with the column name. E.g. list(doc_id = 1, sentence = 1) will be [doc_id = 1, sentence = 2].
This only works if the tagged tokens are used in the html browser created with the |
span_adjacent |
If TRUE, include adjacent tokens with identical attributes within the same tag |
doc_id |
If span_adjacent is TRUE, The document ids are required to ensure that tags do not span from one document to another. |
a character vector of color-tagged tokens
1 2 3 4 5 | highlight_tokens(c('token_1','token_2','token_3'),
value = c(FALSE,FALSE,TRUE))
highlight_tokens(c('token_1','token_2','token_3'),
value = c(0,0.3,0.6))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.