class_docstr: Build an EncodingVisualizer
  
  Args:
  
       tokenizer (:class:`~tokenizers.Tokenizer`):
          A tokenizer instance
  
       default_to_notebook (:obj:`bool`):
          Whether to render html output in a notebook by default
  
       annotation_converter (:obj:`Callable`, `optional`):
          An optional (lambda) function that takes an annotation in any format and returns
          an Annotation object
docstr: Build a visualization of the given text
  
  Args:
      text (:obj:`str`):
          The text to tokenize
  
      annotations (:obj:`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 (:obj:`bool`, `optional`, defaults to `False`):
          If True, will render the html in a notebook. Otherwise returns an html string.
  
  Returns:
      The HTML string if default_to_notebook is False, otherwise (default) returns None and
      renders the HTML in the notebook
docstr_tok: ["Build","a","visualization","of","the","given","text","Args",":","text","(",":","obj",":","`","str","`",")",":","The","text","to","tokenize","annotations","(",":","obj",":","`","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","(",":","obj",":","`","bool","`",",","`","optional","`",",","defaults","to","`","False","`",")",":","If","True",",","will","render","the","html","in","a","notebook",".","Otherwise","returns","an","html","string",".","Returns",":","The","HTML","string","if","default_to_notebook","is","False",",","otherwise","(","default",")","returns","None","and","renders","the","HTML","in","the","notebook"]
code: def __call__(
      self,
      text: str,
      annotations: AnnotationList = [],
      default_to_notebook: Optional[bool] = None,
  ) -> Optional[str]:
      """
      Build a visualization of the given text
  
      Args:
          text (:obj:`str`):
              The text to tokenize
  
          annotations (:obj:`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 (:obj:`bool`, `optional`, defaults to `False`):
              If True, will render the html in a notebook. Otherwise returns an html string.
  
      Returns:
          The HTML string if default_to_notebook is False, otherwise (default) returns None and
          renders the HTML in the notebook
  
      """
      final_default_to_notebook = self.default_to_notebook
      if default_to_notebook is not None:
          final_default_to_notebook = default_to_notebook
      if final_default_to_notebook:
          try:
              from IPython.core.display import HTML, display
          except ImportError as e:
              raise Exception(
                  """We couldn't import IPython utils for html display.
                      Are you running in a notebook?"""
              )
      if self.annotation_coverter is not None:
          annotations = list(map(self.annotation_coverter, annotations))
      encoding = self.tokenizer.encode(text)
      html = EncodingVisualizer.__make_html(text, encoding, annotations)
      if final_default_to_notebook:
          display(HTML(html))
      else:
          return html
  
imports: import itertools
  import os
  import re
  from string import Template
  from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple
  from tokenizers import Encoding, Tokenizer
label_desc: Use image node_id 2 for calling the EncodingVisualizer obj's underlying member method code with example usage: obj.__call__(text, annotations, default_to_notebook) and returns: html