class_docstr: This class represents an error case
  
  Args:
      _input: Original input string
      target: Ground-truth target string
      pred: Predicted string
      mode: A string indicates the mode (i.e., constants.ITN_MODE or constants.TN_MODE)
class_docstr_tok: ["This","class","represents","an","error","case","Args",":","_input",":","Original","input","string","target",":","Ground-truth","target","string","pred",":","Predicted","string","mode",":","A","string","indicates","the","mode","(","i.e.",",","constants.ITN_MODE","or","constants.TN_MODE",")"]
docstr: This method extracts the list of spans.
  
  Args:
      tokens_hightlight: A list of boolean values where each value indicates whether a token needs to be hightlighted.
  
  Returns:
      spans: A list of spans. Each span is represented by a tuple of 3 elements: (1) Start Index (2) End Index (3) A boolean value indicating whether the span needs to be hightlighted.
docstr_tok: ["This","method","extracts","the","list","of","spans",".","Args",":","tokens_hightlight",":","A","list","of","boolean","values","where","each","value","indicates","whether","a","token","needs","to","be","hightlighted",".","Returns",":","spans",":","A","list","of","spans",".","Each","span","is","represented","by","a","tuple","of","3","elements",":","(","1",")","Start","Index","(","2",")","End","Index","(","3",")","A","boolean","value","indicating","whether","the","span","needs","to","be","hightlighted","."]
code: def get_spans(self, tokens_hightlight):
      """
      This method extracts the list of spans.
  
      Args:
          tokens_hightlight: A list of boolean values where each value indicates whether a token needs to be hightlighted.
  
      Returns:
          spans: A list of spans. Each span is represented by a tuple of 3 elements: (1) Start Index (2) End Index (3) A boolean value indicating whether the span needs to be hightlighted.
      """
      spans, nb_tokens = [], len(tokens_hightlight)
      cur_start_idx, cur_bool_val = 0, tokens_hightlight[0]
      for idx in range(nb_tokens):
          if idx == nb_tokens - 1:
              if tokens_hightlight[idx] != cur_bool_val:
                  spans.append(
                      (cur_start_idx, nb_tokens - 2, cur_bool_val)
                  )
                  spans.append(
                      (
                          nb_tokens - 1,
                          nb_tokens - 1,
                          tokens_hightlight[idx],
                      )
                  )
              else:
                  spans.append(
                      (cur_start_idx, nb_tokens - 1, cur_bool_val)
                  )
          else:
              if tokens_hightlight[idx] != cur_bool_val:
                  spans.append((cur_start_idx, idx - 1, cur_bool_val))
                  cur_start_idx, cur_bool_val = (
                      idx,
                      tokens_hightlight[idx],
                  )
      return spans
  
file_path: NeMo/examples/nlp/duplex_text_normalization/analyze_errors.py
imports: from argparse import ArgumentParser
  from typing import List
  from nemo.collections.nlp.data.text_normalization import constants
label_desc: Use image node_id 4 for calling the ErrorCase obj's underlying member method code with example usage: obj.get_spans(tokens_hightlight) and returns: spans