docstr: This forward pass function translates Chinese characters into pinyin sequences and then converts the pinyin
  into phonemes. It is primarily designed to process texts containing with Chinese characters, but we have
  extended its support to handle texts that include both Chinese and English. This extension was mainly
  necessitated by the limited availability of bilingual datasets. The `errors` argument used in the
  `pypinyin.lazy_pinyin` function below is used to process non-Chinese words, where each English word is split
  into letters.
  
  For example, The text "我今天去了Apple Store, 买了一个iPhone。" would be converted as a list,
  `['wo3', 'jin1', 'tian1', 'qu4', 'le5', 'A', 'p', 'p', 'l', 'e', ' ', 'S', 't', 'o', 'r', 'e', ',', ' ', 'mai3',
   'le5', 'yi2', 'ge4', 'i', 'P', 'h', 'o', 'n', 'e', '。']`
docstr_tok: ["This","forward","pass","function","translates","Chinese","characters","into","pinyin","sequences","and","then","converts","the","pinyin","into","phonemes",".","It","is","primarily","designed","to","process","texts","containing","with","Chinese","characters",",","but","we","have","extended","its","support","to","handle","texts","that","include","both","Chinese","and","English",".","This","extension","was","mainly","necessitated","by","the","limited","availability","of","bilingual","datasets",".","The","`","errors","`","argument","used","in","the","`","pypinyin.lazy_pinyin","`","function","below","is","used","to","process","non-Chinese","words",",","where","each","English","word","is","split","into","letters",".","For","example",",","The","text","``","\u6211\u4eca\u5929\u53bb\u4e86Apple","Store",",","\u4e70\u4e86\u4e00\u4e2aiPhone\u3002","''","would","be","converted","as","a","list",",","`","[","'wo3","'",",","'jin1","'",",","'tian1","'",",","'qu4","'",",","'le5","'",",","'","A","'",",","'","p","'",",","'","p","'",",","'","l","'",",","'","e","'",",","'","'",",","'S","'",",","'t","'",",","'","o","'",",","'","r","'",",","'","e","'",",","'",",","'",",","'","'",",","'mai3","'",",","'le5","'",",","'yi2","'",",","'ge4","'",",","'","i","'",",","'","P","'",",","'","h","'",",","'","o","'",",","'n","'",",","'","e","'",",","'\u3002","'","]","`"]
code: def __call__(self, text: str) -> List[str]:
      """
      This forward pass function translates Chinese characters into pinyin sequences and then converts the pinyin
      into phonemes. It is primarily designed to process texts containing with Chinese characters, but we have
      extended its support to handle texts that include both Chinese and English. This extension was mainly
      necessitated by the limited availability of bilingual datasets. The `errors` argument used in the
      `pypinyin.lazy_pinyin` function below is used to process non-Chinese words, where each English word is split
      into letters.
  
      For example, The text "我今天去了Apple Store, 买了一个iPhone。" would be converted as a list,
      `['wo3', 'jin1', 'tian1', 'qu4', 'le5', 'A', 'p', 'p', 'l', 'e', ' ', 'S', 't', 'o', 'r', 'e', ',', ' ', 'mai3',
       'le5', 'yi2', 'ge4', 'i', 'P', 'h', 'o', 'n', 'e', '。']`
      """
      text = set_grapheme_case(text, case=self.ascii_letter_case)
  
      pinyin_seq = []
      words_list = self.word_segmenter(text)
  
      # TODO @xueyang: add a g2p process for non-pinyin words by customizing a function for `errors` argument. For
      #  example, add a dict look up for English words.
      for word in words_list:
          pinyin_seq += self._lazy_pinyin(
              word,
              style=self._Style.TONE3,
              neutral_tone_with_five=True,
              errors=lambda en_words: [letter for letter in en_words],
          )
      phoneme_seq = []
      for pinyin in pinyin_seq:
          # only pinyin has tones while non-pinyin doesn't.
          tone_hyp = pinyin[-1]
          if tone_hyp in self.tone_dict:
              syllable = pinyin[:-1]
              assert (
                  syllable in self.phoneme_dict
              ), f"Syllable <{syllable}> does not exist in the dictionary."
              phoneme_seq += self.phoneme_dict[syllable]
              phoneme_seq.append(self.tone_dict[tone_hyp])
          # All pinyin would end up with a number in 1-5, which represents tones of the pinyin.
          # For symbols which are not pinyin, such as English letters and Chinese punctuations, we directly
          # use them as inputs.
          elif tone_hyp in self.ascii_letter_dict:
              phoneme_seq.append(self.ascii_letter_dict[tone_hyp])
          else:
              phoneme_seq.append(pinyin)
      return phoneme_seq
  
file_path: NeMo/nemo/collections/tts/g2p/models/zh_cn_pinyin.py
imports: import pathlib
  from collections import defaultdict
  from typing import Dict, List, Optional, Union
  from nemo.collections.common.tokenizers.text_to_speech.ipa_lexicon import get_grapheme_character_set
  from nemo.collections.tts.g2p.models.base import BaseG2p
  from nemo.collections.tts.g2p.utils import set_grapheme_case
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the ChineseG2p obj's underlying member method code with example usage: obj.__call__(text) and returns: phoneme_seq