code: def _mat_from_spans_dense(
      spans: Sequence[Tuple[int, int]], n_chars: int
  ) -> np.ndarray:
      """Construct a token-to-char matrix from a list of char spans."""
      M = np.zeros((len(spans), n_chars), dtype=_DTYPE)
      for i, s in enumerate(spans):
          M[i, s[0] : s[1]] = 1
      return M
  
file_path: jiant/jiant/utils/retokenize.py
imports: from typing import Iterable, Sequence, Tuple, Union
  from Levenshtein.StringMatcher import StringMatcher
  from nltk.tokenize.util import string_span_tokenize
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _mat_from_spans_dense(spans, n_chars) and returns: M