code: def get(
      cls,
      src: VizSeqDataSources,
      ref: VizSeqDataSources,
      tags: Optional[VizSeqDataSources] = None,
  ) -> VizSeqStatsResult:
      n_examples = len(src)
      n_src_tokens, n_ref_tokens = defaultdict(int), defaultdict(int)
      n_src_chars, n_ref_chars = defaultdict(int), defaultdict(int)
      src_vocab, ref_vocab = {}, {}
      src_lens, ref_lens = defaultdict(list), defaultdict(list)
      tag_freq = Counter()
  
      for name, cur_src in zip(src.names, src.data):
          for i in range(len(cur_src)):
              src_lens[name].append(cur_src.get_len(i))
              n_src_chars[name] += cur_src.get_len(i, finer=True)
          src_vocab[name] = cur_src.vocab
          n_src_tokens[name] = sum(src_lens[name])
          src_lens[name] = cls.auto_sample(src_lens[name])
          if n_src_chars[name] == 0:
              src_lens[name] = []
  
      for name, cur_ref in zip(ref.names, ref.data):
          for i in range(len(cur_ref)):
              ref_lens[name].append(cur_ref.get_len(i))
              n_ref_chars[name] += cur_ref.get_len(i, finer=True)
          ref_vocab[name] = cur_ref.vocab
          n_ref_tokens[name] = sum(ref_lens[name])
          ref_lens[name] = cls.auto_sample(ref_lens[name])
          if n_ref_chars[name] == 0:
              ref_lens[name] = []
  
      if tags is not None:
          assert tags.text_merged
          for cur_tags in tags.text:
              tag_freq.update(cur_tags)
      tag_freq = tag_freq.most_common()
      src_tkn_log2_freq = {
          k: cls.auto_sample(
              [np.round(np.log2(f + 1), 2) for _, f in v]
          )
          for k, v in src_vocab.items()
      }
      ref_tkn_log2_freq = {
          k: cls.auto_sample(
              [np.round(np.log2(f + 1), 2) for _, f in v]
          )
          for k, v in ref_vocab.items()
      }
      return VizSeqStatsResult(
          n_examples=n_examples,
          n_src_tokens=n_src_tokens,
          n_ref_tokens=n_ref_tokens,
          n_src_chars=n_src_chars,
          n_ref_chars=n_ref_chars,
          tag_freq=tag_freq,
          src_vocab=src_vocab,
          ref_vocab=ref_vocab,
          src_tkn_log2_freq=src_tkn_log2_freq,
          ref_tkn_log2_freq=ref_tkn_log2_freq,
          src_lens=src_lens,
          ref_lens=ref_lens,
      )
  
file_path: vizseq/vizseq/_data/stats.py
imports: from collections import Counter, defaultdict
  from typing import List, NamedTuple, Optional, Tuple, Union, Dict
  import numpy
  from vizseq._data import VizSeqDataSources
label_desc: Use image node_id 2 for calling the VizSeqStats obj's underlying member method code with example usage: obj.get(cls, src, ref, tags) and returns: VizSeqStatsResult