Tokenizers documentation
Visualizer
Visualizer
Python
Rust
Node
Annotation
EncodingVisualizer
class tokenizers.tools.EncodingVisualizer
< source >( tokenizer: Tokenizerdefault_to_notebook: bool = Trueannotation_converter: Optional = None )
Parameters
- tokenizer (Tokenizer) β A tokenizer instance
- default_to_notebook (
bool
) β Whether to render html output in a notebook by default - annotation_converter (
Callable
, optional) β An optional (lambda) function that takes an annotation in any format and returns an Annotation object
Build an EncodingVisualizer
__call__
< source >( text: strannotations: List = []default_to_notebook: Optional = None )
Parameters
- text (
str
) β The text to tokenize - annotations (
List[Annotation]
, optional) β An optional list of annotations of the text. The can either be an annotation class or anything else if you instantiated the visualizer with a converter function - default_to_notebook (
bool
, optional, defaults to False) β If True, will render the html in a notebook. Otherwise returns an html string.
Build a visualization of the given text