code: def per_item_dialog_accuracy(y_true, y_predicted: List[List[str]]):
      # todo metric classes???
      y_true = [y["text"] for dialog in y_true for y in dialog]
      y_predicted = itertools.chain(*y_predicted)
      examples_len = len(y_true)
      correct = sum(
          [
              y1.strip().lower() == y2.strip().lower()
              for y1, y2 in zip(y_true, y_predicted)
          ]
      )
      return correct / examples_len if examples_len else 0
  
file_path: DeepPavlov/deeppavlov/metrics/accuracy.py
imports: import itertools
  import re
  from logging import getLogger
  from typing import List
  import numpy
  from deeppavlov.core.common.metrics_registry import register_metric
label_desc: Use image node_id 9 for calling a global function with example usage: per_item_dialog_accuracy(y_true, y_predicted) and returns: unknown