code: def replace_symbol_to_number(pinyin):
      
      def _replace(match):
          symbol = match.group(0)  # 带声调的字符
          # 返回使用数字标识声调的字符
          return PHONETIC_SYMBOL_DICT[symbol]
  
      # 替换拼音中的带声调字符
      return RE_PHONETIC_SYMBOL.sub(_replace, pinyin)
docs: 把声调替换为数字