code: def text_to_char_array(transcript, alphabet, context=""):
      r"""
      Given a transcript string, map characters to
      integers and return a numpy array representing the processed string.
      Use a string in `context` for adding text to raised exceptions.
      """
      if not alphabet.CanEncode(transcript):
          # Provide the row context (especially wav_filename) for alphabet errors
          raise ValueError(
              'Alphabet cannot encode transcript "{}" while processing sample "{}", '
              "check that your alphabet contains all characters in the training corpus. "
              "Missing characters are: {}.".format(
                  transcript,
                  context,
                  list(
                      ch
                      for ch in transcript
                      if not alphabet.CanEncodeSingle(ch)
                  ),
              )
          )
  
      encoded = alphabet.Encode(transcript)
      if len(encoded) == 0:
          raise ValueError(
              "While processing {}: Found an empty transcript! "
              "You must include a transcript for all training data.".format(
                  context
              )
          )
      return encoded
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  import struct
label_desc: Use image node_id 1 for calling a global function with example usage: text_to_char_array(transcript, alphabet, context) and returns: encoded