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",")"]
code: def __init__(
      self, _input: str, target: str, pred: str, classes: str, mode: str
  ):
      self._input = _input
      self.target = target
      self.pred = pred
      self.mode = mode
      self.classes = classes
  
      # Tokens
      self.target_tokens = self.target.split(" ")
      self.pred_tokens = self.pred.split(" ")
  
      # LCS
      lcs_tokens = lcs(self.target_tokens, self.pred_tokens)
      target_tokens_hightlight = [False] * len(self.target_tokens)
      pred_tokens_hightlight = [False] * len(self.pred_tokens)
      target_idx, pred_idx = 0, 0
      for token in lcs_tokens:
          while self.target_tokens[target_idx] != token:
              target_idx += 1
          while self.pred_tokens[pred_idx] != token:
              pred_idx += 1
          target_tokens_hightlight[target_idx] = True
          pred_tokens_hightlight[pred_idx] = True
          target_idx += 1
          pred_idx += 1
  
      # Spans
      self.target_spans = self.get_spans(target_tokens_hightlight)
      self.pred_spans = self.get_spans(pred_tokens_hightlight)
  
      # Determine unhighlighted target spans
      unhighlighted_target_spans = []
      for ix, t in enumerate(self.target_spans):
          if not t[-1]:
              unhighlighted_target_spans.append((ix, t))
      # Determine unhighlighted pred spans
      unhighlighted_pred_spans = []
      for ix, t in enumerate(self.pred_spans):
          if not t[-1]:
              unhighlighted_pred_spans.append((ix, t))
  
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 1 to create a new ErrorCase object  with example: obj = ErrorCase(_input, target, pred, classes, mode)