code: def tokenize_corpus(corpus, num_words=-1):
      # Fit a Tokenizer on the corpus
      if num_words > -1:
          tokenizer = Tokenizer(num_words=num_words)
      else:
          tokenizer = Tokenizer()
      tokenizer.fit_on_texts(corpus)
      return tokenizer
  
file_path: BigDL/docs/docs/ClusterServingGuide/OtherFrameworkUsers/l10c03_nlp_constructing_text_generation_model.py
imports: import tensorflow
  from tensorflow.keras.preprocessing.text import Tokenizer
  from tensorflow.keras.preprocessing.sequence import pad_sequences
  import string
  import numpy
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: tokenize_corpus(corpus, num_words) and returns: tokenizer