code: def length_metric_analysis(models, dataset, results, charts):
      src_text = dataset.source_text
      tgt_text = dataset.target_text
      src_len = np.array([len(word_tokenize(s)) for s in src_text])
      tgt_len = np.array([len(word_tokenize(t)) for t in tgt_text])
  
      group_num = 5
      for length, name in zip([src_len, tgt_len], ["Source", "Target"]):
          idx = np.argsort(length)
          idx = np.array_split(idx, group_num)
          x = []
          for i in idx:
              x.append(f"{length[i].min()} - {length[i].max()}")
          for metric in results[0].keys():
              if (
                  not isinstance(results[0][metric], list)
                  or len(results[0][metric]) == 1
              ):
                  continue
              chart = Boxplot(
                  init_opts=opts.InitOpts(
                      theme=ThemeType.SHINE,
                      width="900px",
                      height="400px",
                  )
              )
              chart.add_xaxis(x)
              for result, model in zip(results, models):
                  y = []
                  for i in idx:
                      y.append(np.array(result[metric])[i].tolist())
                  chart.add_yaxis(
                      model,
                      chart.prepare_data(y),
                      tooltip_opts=opts.TooltipOpts(
                          textstyle_opts=opts.TextStyleOpts(
                              color="white", **default_text_style
                          )
                      ),
                  )
              chart.set_global_opts(
                  title_opts=opts.TitleOpts(
                      title=f"{metric.title()} acc. {name} Length",
                      title_textstyle_opts=opts.TextStyleOpts(
                          **default_text_style
                      ),
                  ),
                  legend_opts=opts.LegendOpts(
                      pos_top=25,
                      textstyle_opts=opts.TextStyleOpts(
                          **default_text_style
                      ),
                  ),
                  xaxis_opts=opts.AxisOpts(
                      name="Length",
                      axislabel_opts=opts.LabelOpts(
                          **default_text_style
                      ),
                      name_textstyle_opts=opts.TextStyleOpts(
                          **default_text_style
                      ),
                  ),
                  yaxis_opts=opts.AxisOpts(
                      axislabel_opts=opts.LabelOpts(
                          **default_text_style
                      )
                  ),
              )
              charts.add(chart)
  
imports: import argparse
  import pickle
  import numpy
  import scipy
  from collections import Counter
  from nltk.util import ngrams
  from nltk.tokenize import word_tokenize
  from nltk.stem import WordNetLemmatizer
  from nltk import pos_tag
  from nltk.corpus import stopwords
  from pyecharts import options
  from pyecharts.charts import Page, Grid, Boxplot, WordCloud
  from pyecharts.globals import ThemeType, SymbolType
  from pyecharts.components import Table
  from pyecharts.options import ComponentTitleOpts
  from textbox.config.configurator import Config
  from textbox.evaluator import BaseEvaluator
  from textbox.data.utils import AbstractDataset
label_desc: Use image node_id 4 for calling a global function with example usage: length_metric_analysis(models, dataset, results, charts) without return types