code: def normalize(
      txt,
      vocab=None,
      replace_char=" ",
      max_length=300,
      pad_out=True,
      to_lower=True,
      reverse=False,
      truncate_left=False,
      encoding=None,
  ):
      # remove html
      # This will keep characters and other symbols
      txt = txt.split()
      # Remove HTML
      txt = [re.sub(r"http:.*", "", r) for r in txt]
      txt = [re.sub(r"https:.*", "", r) for r in txt]
  
      txt = " ".join(txt)
  
      # Remove punctuation
      txt = re.sub("[.,!]", " ", txt)
      txt = " ".join(txt.split())
  
      # store length for multiple comparisons
      txt_len = len(txt)
  
      if truncate_left:
          txt = txt[-max_length:]
      else:
          txt = txt[:max_length]
      # change case
      if to_lower:
          txt = txt.lower()
      # Reverse order
      if reverse:
          txt = txt[::-1]
      # replace chars
      if vocab is not None:
          txt = "".join(
              [c if c in vocab else replace_char for c in txt]
          )
      # re-encode text
      if encoding is not None:
          txt = txt.encode(encoding, errors="ignore")
      # pad out if needed
      if pad_out and max_length > txt_len:
          txt = txt + replace_char * (max_length - txt_len)
      return txt
  
file_path: nlp-architect/nlp_architect/utils/generic.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import re
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: normalize(txt, vocab, replace_char, max_length, pad_out, to_lower, reverse, truncate_left, encoding) and returns: txt