code: def generate(self):
      number_of_words = int(
          np.round(
              max(
                  1,
                  np.random.normal(
                      self.params.number_of_words_mean,
                      self.params.number_of_words_sigma,
                  ),
              )
          )
      )
  
      out = []
      for i in range(number_of_words):
          word_length = int(
              np.round(
                  max(
                      1,
                      np.random.normal(
                          self.params.word_length_mean,
                          self.params.word_length_sigma,
                      ),
                  )
              )
          )
          rnd = np.random.rand(10)
  
          if rnd[0] < self.params.sub_script_p:
              script = Script.SUB
          elif (
              rnd[0]
              < self.params.sub_script_p + self.params.super_script_p
          ):
              script = Script.SUPER
          else:
              script = Script.NORMAL
  
          if (
              rnd[1] < self.params.bold_p
              and rnd[2] < self.params.italic_p
          ):
              variant = FontVariantType.BOLD_ITALICS
          elif rnd[1] < self.params.bold_p:
              variant = FontVariantType.BOLD
          elif rnd[2] < self.params.italic_p:
              variant = FontVariantType.ITALIC
          else:
              variant = FontVariantType.NORMAL
  
          if rnd[3] < self.params.letter_spacing_p:
              letter_spacing = np.random.normal(
                  self.params.letter_spacing_mean,
                  self.params.letter_spacing_sigma,
              )
          else:
              letter_spacing = 0
  
          if script == Script.NORMAL and len(out) > 0:
              out.append(
                  Word(
                      self.params.word_separator,
                      Script.NORMAL,
                      0,
                      FontVariantType.NORMAL,
                  )
              )
  
          charset = [
              self.charset,
              self.super_charset,
              self.sub_charset,
          ][script]
          s = "".join(np.random.choice(charset, word_length))
          s = s.strip()
  
          out.append(Word(s, script, letter_spacing, variant))
  
      return out
  
imports: from calamari_ocr.ocr.dataset.datareader.generated_line_dataset import TextGeneratorParams
  from calamari_ocr.ocr.dataset.datareader.generated_line_dataset.line_generator import Script, Word, FontVariantType
  import numpy
label_desc: Use image node_id 3 for calling the TextGenerator obj's underlying member method code with example usage: obj.generate() and returns: out