class_docstr: Character metrics for text recognition task.
  
  Args:
      valid_symbol (str): Valid characters.
          Defaults to '[^A-Z^a-z^0-9^一-龥]'
      collect_device (str): Device name used for collecting results from
          different ranks during distributed training. Must be 'cpu' or
          'gpu'. Defaults to 'cpu'.
      prefix (str, optional): The prefix that will be added in the metric
          names to disambiguate homonymous metrics of different evaluators.
          If prefix is not provided in the argument, self.default_prefix
          will be used instead. Defaults to None.
code: def __init__(
      self,
      valid_symbol: str = "[^A-Z^a-z^0-9^\u4e00-\u9fa5]",
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ) -> None:
      super().__init__(collect_device, prefix)
      self.valid_symbol = re.compile(valid_symbol)
  
imports: import re
  from difflib import SequenceMatcher
  from typing import Dict, Optional, Sequence, Union
  import mmengine
  from mmengine.evaluator import BaseMetric
  from rapidfuzz.distance import Levenshtein
  from mmocr.registry import METRICS
label_desc: Use image node_id 1 to create a new CharMetric object from inherited base classes: BaseMetric with example: obj = CharMetric(valid_symbol, collect_device, prefix)