code: def view_stats(
      sources: PathOrPathsOrDictOfStrList,
      references: PathOrPathsOrDictOfStrList,
      tags: Optional[PathOrPathsOrDictOfStrList] = None,
  ):
      _src = VizSeqDataSources(sources, text_merged=True)
      _ref = VizSeqDataSources(references, text_merged=True)
      _tags = (
          None
          if tags is None
          else VizSeqDataSources(tags, text_merged=True)
      )
      stats = VizSeqStats.get(_src, _ref, _tags)
  
      html = env.get_template("ipynb_stats.html").render(
          stats=stats.to_dict(formatting=True),
          enum_src_names_and_types=VizSeqDataPageView.get_enum(
              zip(_src.names, [t.name.title() for t in _src.data_types])
          ),
          enum_ref_names=VizSeqDataPageView.get_enum(_ref.names),
      )
      display(HTML(html))
  
      n_src_plots = len(_src.text_indices)
      n_plots = n_src_plots + _ref.n_sources
      plt.ion()
      fig, ax = plt.subplots(
          nrows=1, ncols=n_plots, figsize=(7 * n_plots, 5)
      )
      for i, idx in enumerate(_src.text_indices):
          cur_ax = ax if n_plots == 1 else ax[i]
          name = _src.names[idx]
          cur_sent_lens = stats.src_lens[name]
          _ = cur_ax.hist(cur_sent_lens, density=True, bins=25)
          _ = cur_ax.axvline(
              x=np.mean(cur_sent_lens), color="red", linewidth=3
          )
          cur_ax.set_title(f"Source {name} Length")
      for i, idx in enumerate(_ref.text_indices):
          cur_ax = ax if n_plots == 1 else ax[n_src_plots + i]
          name = _ref.names[idx]
          cur_sent_lens = stats.ref_lens[name]
          _ = cur_ax.hist(cur_sent_lens, density=True, bins=25)
          _ = cur_ax.axvline(
              x=np.mean(cur_sent_lens), color="red", linewidth=3
          )
          cur_ax.set_title(f"Reference {name} Length")
  
file_path: vizseq/vizseq/ipynb/core.py
imports: from typing import List, Optional
  from jinja2 import Environment, PackageLoader, select_autoescape
  import matplotlib.pyplot
  import numpy
  from IPython.display import HTML, display
  from vizseq._data import VizSeqDataSources, PathOrPathsOrDictOfStrList, VizSeqNGrams, VizSeqStats, get_g_translate, set_g_cred_path
  from vizseq._visualizers import SPAN_HIGHTLIGHT_JS
  from vizseq._view import VizSeqDataPageView, VizSeqWebView, VizSeqSortingType, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_NO
  from vizseq.scorers import get_scorer_ids, get_scorer, get_scorer_name
  from vizseq._utils.logger import logger
label_desc: Use image node_id 4 for calling a global function with example usage: view_stats(sources, references, tags) without return types