class_docstr: Handles chunking by adding a new set of offsets system keyed by "chunk"
  Performs chunking based on the following rules
  
  * Select longest axis of the table, rows or columns
  * For this longest axis, chunk such that each chunk's effective num tokens is less than the defined max_length
  * effective num tokens is the number of tokens you get if you duplicate tokens by the number of cells they span.
  * Each chunk get's n_rows_context rows of context from the beginning of the opposite axis to the one being chunked (2 rows of context if columns are chunked)
  * If n_rows_context takes up more than max_length / 2 effective tokens then this context is backed off until the amount of context is less than max_length / 2.
  
  
  There is no invese chunking as TableETL.resolve_preds will simply map directly from chunk to document if chunking is enabled.
code: def _make_chunks(self, row_spans):
      for n_rows_context in range(self.n_rows_context, -1, -1):
          context = row_spans[:n_rows_context]
          context_tokens = self._num_tokens(context)
          if context_tokens < (self.max_length // 2):
              break
      max_len_chunks = []
      temp_rows = []
      context_included = False
      for row in row_spans[n_rows_context:]:
          if (
              self._num_tokens(context + temp_rows + [row])
              < self.max_length
          ):
              temp_rows.append(row)
          elif len(temp_rows) == 0:
              # The current row is too long to use any context at all.
              max_len_chunks.append([row])
          else:
              context_included = True
              max_len_chunks.append(copy.deepcopy(context) + temp_rows)
              temp_rows = [row]
      if temp_rows or not context_included:
          max_len_chunks.append(copy.deepcopy(context) + temp_rows)
      output_spans = []
      for chunk in max_len_chunks:
          temp_chunk = []
          for span in sorted(
              (span for row in chunk for span in row["spans"]),
              key=lambda x: x["start"],
          ):
              if (
                  temp_chunk
                  and temp_chunk[-1]["end"] + 1 == span["start"]
              ):
                  temp_chunk[-1]["end"] = span["end"]
                  temp_chunk[-1]["num_tokens"] += span["num_tokens"]
                  temp_chunk[-1]["num_effective_tokens"] += span[
                      "num_effective_tokens"
                  ]
              else:
                  temp_chunk.append(span)
          output_spans.append(temp_chunk)
      return output_spans
  
imports: import copy
  import functools
  import os
  import tempfile
  import typing
  import sys
  from finetune.base_models import TableRoBERTa
  from finetune.util.metrics import sequences_overlap
  from finetune.scheduler import Scheduler
  from finetune.encoding.input_encoder import BaseEncoder
  from finetune import SequenceLabeler
label_desc: Use image node_id 6 for calling the TableChunker obj's underlying member method code with example usage: obj._make_chunks(row_spans) and returns: output_spans